This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: (Meta) Guile and direction




What's the difference between a class and a module?
Technically there is *no* difference.  Classes and modules
belong to different domains, that's all.


At least to me it doesn't make sense to access class components
with:

   (slot-ref (slot-ref (slot-ref a 'b) 'c) 'd)

but module components with:

   a:b:c:d

(or so; CLOS is incredibly idiosyncratic.)


One more thing: When you reject the a:b syntax, you must also reject
the generalized set! syntax.  The syntax (set! a:b val) is much better
than (set! (b a) val) simply because set! changes bindings, not
objects.  Ask Matthias Felleisen, if you don't know what I mean. :)


A simple example:
(define-module (test))
(export (a mutable-location (alias test:a)))
(define a 1)

(define-module (client-of-test) :use-module (test))
test:a -> 1
(set! test:a 99)
(go (test))

a -> 1


In the above example set! has changed the binding (test:a . 1) to
(test:a . 99). `a' which is an alias for test:a follows.

At least to me the generalized set! syntax is more idiosyncratic
than Lalo's proposal.


Jost

P.S.: When we drop slot-ref and slot-set!, how can people access
component `d'?  Hmm, I think class components should have names, just
like environments which bind symbols to locations classes bind names
to components.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]