On 23/10/2009 17:51, Bill Baxter wrote:
On Fri, Oct 23, 2009 at 5:13 AM, Andrei Alexandrescu
<seewebsiteforem...@erdani.org>  wrote:
Yigal Chripun wrote:

On 23/10/2009 13:02, bearophile wrote:

Chris Nicholson-Sauls:

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

That's quite less readable. Scala sometimes has some unreadable syntax.
Python has taught me how much useful a readable syntax is :-)
Designing languages requires to find a balance between several different
and opposed needs.

Bye,
bearophile

how about this hypothetical syntax:

list ~= [0..10];

I'm not sure what the type of "list" is supposed to be, but this works today
for arrays:

list ~= array(iota(0, 10));

While we're not on the subject....
"Iota" is right up there with "inSitu".
I know it has a precedent elsewhere, but it sounds about as user
friendly as monads.  It just sounds like the language it trying to be
snooty.  Like "if you don't even know what iota is, you're clearly not
qualified to join our little D club. Maybe you should try Java... or
Logo".   Compare that to Python where it's called "range", something
every Joe the Programmer can certainly grok without having to get a
Greek to English dictionary.

--bb

Ranges are already part of the compiler because of foreach, can we also add language support for Range literals?
i.e
(1..10) => range(1, 10) //(I'm using BB's much better name)
[1..10] => array(range(1, 10))

it already is supported is foreach, isn't it?
foreach (i; 1..10) {...}



Reply via email to