[Prev][Next][Index][Thread]

Re: Q: member syntax in dylan?



On Thursday, May 10, 2001, at 02:45  pm, Roland Paterson-Jones wrote:

> OK, understood. Is there any way in dylan of achieving the required
> semantics with this or some similar syntax?

I'm not sure. I think the parser will eat the case I gave before 
anything else you could do. A macro might work, but I don't know how.

> The motivation is, of course, that it's fun to associate methods with 
> their
> class,

Classes don't have methods in Dylan. It takes a bit of a mental leap to 
accept this (especially coming from a Java background), but once this is 
made the Dylan way really is better.

> particularly when their are no multi-dispatch issues. I believe that
> this encourages object-oriented programming (having come, of course, 
> from
> java and c++).

It encourages retaining the feel of a particular variety of OOP, but it 
also  encourages "bad habits" from C++/Java (I say this as someone who's 
programmed C++ and Java professionally and far prefers Dylan).

> I have the feeling that, most of the time, methods I write would be (in
> effect) single-dispatched on one (the first) argument.

Probably, but they will still be generic function methods. Think of a 
hierarchy of methods parallel to your hierarchy of data objects, all 
friend's with each other.

See Michael Richter's posting on classes and methods in Dylan for a 
better explanation than I can give: 
http://www.gwydiondylan.org/mtr-on-dylan.txt

- Rob.


References: