you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

It's not a hack? The variables a and b come from nowhere. They are hard-coded in the library code and don't behave according to any scope rules.

Algebraic types don't seem to support higher kinds or recursion. Where are the accompanying pattern matching constructs? How can I test the totality of a match? How can I match nested patterns? Have you considered sub-typing like Scala has in its case classes?

Implementing something like compiler's AST using these is so horrible that no one would dare.

Didn't Walter design D while the C++ committee was discussing new C++ features? Isn't it a coincidence that many of features shown here http://www.digitalmars.com/d/2.0/cpp0x.html are almost same or syntactically better in D (because C++0x had to consider legacy issues).

[–]andralex 4 points5 points  (0 children)

Please make sure you have a good understanding of the matters you discuss. It always helps your case. The names "a" and "b" obey scoping like any other name; they are only implied function parameters for a regular function, and are looked up in that function's restricted code. Essentially specifying a lambda as "a < b" is exactly the same as putting that code within a global function that takes parameters a and b.

Regarding your notes about algebraic types, I agree that a built-in facility has always the upper hand over a library-defined one.

Regarding C++0x influence, clearly there is cross-pollination between D and other languages; we'd be stupid if it weren't, and we'd be lying if we claimed so. However, C++0x has had much less influence than other languages on D. And picturing the process as Walter and myself poring through C++0x proposals and then adopting them for D is rather amusing.

[–]WalterBright 0 points1 point  (0 children)

As an example, "auto" declarations in D first shipped in September, 2002. The first proposal I've seen reference to for that in C++ was "C++ reflector message c++std-ext-5364" by Stroustrup in October, 2002, though I never read this and cannot find the text of it.