Targeting C

Denis Koroskin 2korden at gmail.com
Fri Oct 30 09:47:48 PDT 2009


On Fri, 30 Oct 2009 10:05:27 +0300, rmcguire <rjmcguire at gmail.com> wrote:

> Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
>
>> grauzone wrote:
>>> Andrei Alexandrescu wrote:
>>>> Pelle Månsson wrote:
>>>>> Andrei Alexandrescu 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));
>>>>>>
>>>>>>
>>>>>> Andrei
>>>>> What does iota mean?
>>>>
>>>> http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota
>>> This link jumps straight to:
>>>
>>> Take!(Sequence!("a.field[0] + n *
>>> a.field[1]",Tuple!(CommonType!(B,E),S))) iota(B, E, S)(B begin, E end,  
>>> S
>>> step);
>>>
>>> Wow, please tell me this is a ddoc malfunction. I mean, that thing left
>>> to iota is supposed to be a type?
>>>
>>> (OK, it _is_ a malfunction, but that thing is still supposed to be... a
>>> type?)
>>
>> Well what was I supposed to do? It was either define another type Iota,
>> or reuse existing types. I chose to reuse.
>>
>> Andrei
>>
>
>
> Hi Andrei,
>
> Could you tell me why:
> Take!(Sequence!("a.field[0] + n *  
> a.field[1]",Tuple!(CommonType!(B,E),S)))
>
> Is a type and not a value?
>
> -Rory
>

I guess Take!(T) is a type, returned by a take(T t, int limit) function  
(it accepts a range and returns other range with a "limit" elements at  
most). The naming is consistent with a function, but capitalized to  
reflect that it's actually a type, not a function.



More information about the Digitalmars-d mailing list