new, pattern matching, scoping
Bill Baxter
dnewsgroup at billbaxter.com
Tue Mar 4 14:31:05 PST 2008
Robert Fraser wrote:
> Interesting articles! First one was too long ;-P, but here are my
> thoughts on the others:
>
> bearophile wrote:
>> Pattern matching, like in Mathematica (very refined), OCaml (faster),
>> Haskell (simple), or OMeta (powerful) is probably useful inside D too,
>> this is a page from Haskell docs:
>> http://www.haskell.org/tutorial/patterns.html
>
> Well, I agree pattern matching is a useful construct. We already have
> some sort of "pattern matching" with template specialization.
Yes, but it isn't working nearly as reliably as it does in those other
languages for some reason. Perhaps its harder because D has more
complicated automatic promotion/conversion rules?
> How exactly do you think this could be worked into D, however, since we
> don't have first-class tuples or dynamic typing?
First class tuples is something that can potentially be changed.
Automatic flattening behavior in D tuples would probably have to go,
though, for it to be really useful.
Dynamic typing isn't necessary or even desirable for type inference. At
least Haskell and OCaml are both statically typed. Probably the others too.
--bb
More information about the Digitalmars-d
mailing list