digitalmars.D - new, pattern matching, scoping
- bearophile (8/8) Mar 04 2008 A nice article that shows why D may be better without the "new" statemen...
- renoX (7/11) Mar 04 2008 Very interesting, thanks. You're right: D would be better to follow his ...
- Sean Kelly (5/7) Mar 04 2008 Interesting article, but I don't think that it applies to D because D co...
- Robert Fraser (10/14) Mar 04 2008 Interesting articles! First one was too long ;-P, but here are my
A nice article that shows why D may be better without the "new" statement (and Python just uses () to instantiate, but D may need a finer control during struct/object creation): http://www.scs.stanford.edu/~dm/home/papers/c++-new.html 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 With the closures of D 2.x, D may need to improve its scoping rules to something more clean: http://tratt.net/laurie/tech_articles/articles/designing_sane_scoping_rules Bye, bearophile
Mar 04 2008
bearophile Wrote:A nice article that shows why D may be better without the "new" statement (and Python just uses () to instantiate, but D may need a finer control during struct/object creation): http://www.scs.stanford.edu/~dm/home/papers/c++-new.htmlVery interesting, thanks. You're right: D would be better to follow his advice (though I suspect that it may prove harder than it seems). [cut]With the closures of D 2.x, D may need to improve its scoping rules to something more clean: http://tratt.net/laurie/tech_articles/articles/designing_sane_scoping_rulesAlso interesting, although I think the way she oppose nonlocal and global is quite artificial, those are different scope with different usage, and I wasn't surprised at all by the way Python behave in her first example, even though I don't know much about Python. Thanks for these links. renoX
Mar 04 2008
== Quote from bearophile (bearophileHUGS lycos.com)'s articleA nice article that shows why D may be better without the "new" statement (and Python just uses () toinstantiate, but D may need a finer control during struct/object creation):http://www.scs.stanford.edu/~dm/home/papers/c++-new.htmlInteresting article, but I don't think that it applies to D because D contains no polymorphic value types, and thus the syntax for new/delete is consistent for all types in D. Still reading the other links. Sean
Mar 04 2008
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.htmlWell, I agree pattern matching is a useful construct. We already have some sort of "pattern matching" with template specialization. How exactly do you think this could be worked into D, however, since we don't have first-class tuples or dynamic typing?With the closures of D 2.x, D may need to improve its scoping rules to something more clean: http://tratt.net/laurie/tech_articles/articles/designing_sane_scoping_rulesD doesn't have implicit variable declaration, so this isn't as much of an issue. IMO, marking every other variable I reference (i.e. member variables in classes enclosing methods, etc.), would just be too much work.
Mar 04 2008