I just have to say that string mixins rock

Russel Winder russel at winder.org.uk
Thu Jul 26 08:26:11 PDT 2012


On Thu, 2012-07-26 at 15:52 +0200, Philippe Sigaud wrote:
[…]
> Fair point, but a few years ago, I had no experience in Lisp, Python
> or Ruby. Not even Haskell nor ML. I was a provincial C/C++ user :)
> I'm cured of that.

I have no doubt that learning those other languages improved you C and C
++ programming.

> Anyway, do many languages use MOPs ? I thought CLOS/MOP was more
> one-of-a-kind curiosity for Common Lisp ? I know Python has
> metaclasses, but until know I did not see them as a meta-object
> protocol.

Whilst Lisp is the original MOP, all dynamic languages have something
that is equivalent if not actually a MOP.  Python, Ruby, Groovy, JRuby,
Clojure, etc. all have the ability to do that which Lisp MOP enables,
they just do it slightly differently. Python has metaclasses yes but
this is just one aspect of what we mean these days by MOP (which really
isn't about objects at all).

C++ can be regarded as having a compile time MOP just not a runtime one
as classic MOP in the dynamic languages implies.

> So yes, D is still behind Lisp as far as crafting code is concerned
> (but what language isn't?), but I think the recent increase in power
> for CTFE opened new vistas and we are beginning to see the effect of
> that (cue std.regex).

CTFE certainly moves D far ahead of C++ and up towards the dynamic
languages.

> And, we are not *that far* from being able to encode user-defined AST
> transformations on D source code, so that people will be able to
> define their own syntax.

Having AST transforms is a huge win for the dynamic languages. The most
recent big win is that Groovy 2 has added a @CompileStatic AST transform
which means that you can statically type and compile sections of Groovy
code. This leads to a whole new way of working on the JVM. Write using
dynamic Groovy, profile to find the performance bottleneck, annotate
with some extra type information add @CompileStatic and notice
performance being as close to pure Java code as makes no difference.

I have no doubt JRuby will pick up on this and follow suite in some way.

Java 8 and its lambda functions is nigh on irrelevant for people willing
to use Groovy.  This will happen because despite being a bit of an
amateur group of volunteers plus 5 SpringSource/VMWare employees, Groovy
has good penetration and increasing traction.

What D needs is some publicized corporate take up with case studies,
showing how superior to C++ it is, with real code not just philosophy.
All the language features are there, and there are some vociferous
supporters, but this is not being turned into real traction. Somehow the
marketing is currently not working.

Comparing Groovy/Java and D, Groovy succeeded by finding a use case in a
Java system that was so "just the right thing" that people looked and
used.

What is the equivalent for D. Is the target C, C++, Fortran, Go, Java?
What is the problem that D can solve that is so damned difficult in C, C
++, Go, Fortran?
   



-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120726/1e99a195/attachment.pgp>


More information about the Digitalmars-d mailing list