Clay language

bearophile bearophileHUGS at lycos.com
Mon Dec 27 22:09:44 PST 2010


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

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


More information about the Digitalmars-d mailing list