Clay language
Lutger Blijdestijn
lutger.blijdestijn at gmail.com
Tue Dec 28 04:53:13 PST 2010
bearophile wrote:
> Andrei:
>
>> FWIW I just posted a response to a question asking for a comparison
>> between Clay and D2.
>>
>>
http://www.reddit.com/r/programming/comments/es2jx/clay_programming_language_wiki/
>
> Just few comments:
>
>> The docs offer very little on Clay's module system (which is rock solid
>> in D2).
>
> D2 module system may be fixed, but currently it's not even bread-solid.
>
> The Clay syntax for imports is more similar to what I have desired for D
> (but that () syntax is not so good):
>
> import foo.bar; // Imports module foo.bar as a qualified path
> // use "foo.bar.bas" to access foo.bar member bas
> import foo.bar as bar; // Imports module foo.bar with alias bar
> // use "bar.bas" to access foo.bar member bas
> import foo.bar.(bas); // Imports member bas from module foo.bar
> // use "bas" to access foo.bar member bas
> import foo.bar.(bas as fooBarBas) // Imports member bas with alias
> fooBarBas import foo.bar.*; // Imports all members from module foo.bar
This looks like a subset of the D module system. The only difference is
'static' import by default and the .* feature which has to be implemented by
the library author in D. Are those the things you find missing in D?
> I don't know about Modula3 module system, I will search info about it.
>
>
>>Clay mentions multiple dispatch as a major feature. Based on extensive
>>experience in the topic I believe that that's a waste of time. Modern C++
>>Design has an extensive chapter on multiple dispatch, and I can vouch next
>>to nobody uses it in the real world. Sure, it's nice to have, but its
>>actual applicability is limited to shape collision testing and a few toy
>>examples.<
>
> I think double dispatch is enough, it cover most cases and keeps both
> compiler complexity low enough. If you put double dispatch with a nice
> syntax in D then maybe people will use it. There are many things that
> people in other languages use that C++ programmers don't use because using
> it in C++ is ugly, a pain, unsafe, etc. The visitor pattern is used enough
> in Java (Scala too was designed to solve this problem).
>
> Bye,
> bearophile
I think I agree here. I have never programmed much in a language with
multiple dispatch, but everytime I see dynamic casting or the visitor
pattern in an OOP program I think about how that would be so much better.
Honestly its just speculation, but I guess that the lack of interest is
because it is not a widely known and available solution. Library
implementations have issues, both usability and performance wise.
More information about the Digitalmars-d
mailing list