bearophile wrote:
Pelle Månsson:

Personally, I like this:
foreach (i; 0..10) list ~= i;
more. :)

While I like this more:
for (i in 0 .. 10)
    list ~= i;

Bye,
bearophile

I prefer this (Scala):
list = list ++ (0 to 10)

Okay, that's not really fair.  The direct port to Scala would be more like:
for { i <- 0 to 10 } list :::= List(i)

Ultimately, syntax only really matters greatly where it provides some significant advantage or detours from some significant disadvantage. Kinda like the '$' in array indices. Early on in D, we had no such creature, but I threw my support fully behind it because of my prior experience with ColdC (and λμ, etc) and its use of the same syntax. Generally speaking, when a given language has an inordinate amount of syntax in some activity, it is probably a good sign that activity is uncommon when the language is properly applied. Conversely, a terse compact syntax is a good sign that's common usage. Depends on "genre"... and now I'm ranting and have no idea why.

-- Chris Nicholson-Sauls

Reply via email to