foreach, an analogy
Andrey Khropov
andkhropov_nosp at m_mtu-net.ru
Sat Oct 21 07:22:19 PDT 2006
Brad Anderson wrote:
> I would guess that Walter has forgotten more about language architectures and
> compiler design than you two ever knew combined. foreach_reverse is not a
> large enough issue to question Walter's abilities.
My intention was not to offend him personally, but some design decisions seem
to be really strange.
There're foreach analogs in Java 1.5, C#, Python, Ruby etc.
but none of these languages have foreach_reverse.
Why do you think?
I think because reverse it's not so common operation and should better be
accomplished in such a way (more generic):
---------------
foreach(i;array.reverseIter)
--------------
IMHO, it's more flexible.
>
> If you've listened closely, and I don't think you have, he has said repeatedly
> that he sees enough utility (its use w/ arrays) that it's staying. Give it a
> few releases and hopefully this woeful abomination of sugar won't affect you
> too much.
I think language should be consistent.
Shouldn't contain unnecessary built-in hacks.
Why not foreach_inorder, foreach_preorder, foreach_postorder,
foreach_depthfirst, foreach_breadthfirst?
Want syntactic sugar for common operations?
Allow syntax extensions such as in Nemerle:
http://nemerle.org/Syntax_extensions
More information about the Digitalmars-d-announce
mailing list