Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] a reckless proposal
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Bruce Hoult <bruce@h...>
Subject: Re: [Caml-list] a reckless proposal
At 8:35 AM -0700 26/7/01, Miles Egan wrote:
>On Wed, Jul 25, 2001 at 10:30:09AM +0100, Dave Berry wrote:
>>  So perhaps Ocaml should adopt the approach used in Dylan and Moby,
>>  where field names in class definitions have module scope.  Then
>>  records and objects would have similar scoping rules, instead of
>>  the current clash, and the distinction between modules and objects
>>  would be clearer.
>
>I suppose this is also similar to CLOS generics, right?  I suppose 
>this would be more consistent but perhaps even more confusing to 
>people who've been writing ClassA.field and ClassB.field since the 
>first day of their first Java class.

Sorry to reply to this a couple of days late, but I was preoccupied 
with a certain programing contest...

Yes, the Dylan object system is extremely similar to CLOS.  But the 
language provides just a little syntactic sugar so that instead of 
"field(object)" (or "(field object) in Lisp") you can also write 
"object.field".  Also, instead of field-setter(newVal, object) you 
can write object.field := newVal.  And a similar syntax 
correspondence for "a[i]" and "a[i] := b" which expand to calls to 
element() and element-setter().

A needless inconsistency compared to the simplicity and power of pure 
S-expressions, for sure, but one that as a Pascal and C/C++ and Java 
programmer I find very comfortable.

-- Bruce
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr