Any chance to call Tango as Extended Standard Library

Lars Ivar Igesund larsivar at igesund.net
Sun Jan 18 08:56:49 PST 2009


Lars Ivar Igesund wrote:

> Andrei Alexandrescu wrote:
> 
>> Denis Koroskin wrote:
>>> On Sun, 18 Jan 2009 18:21:55 +0300, Andrei Alexandrescu
>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>> 
>>>> Lars Ivar Igesund wrote:
>>>>> Andrei Alexandrescu wrote:
>>>>>
>>>>>> For example, I'm not sure how code in std.algorithm could help
>>>>>> containers or streams in Tango (as it should), or how to reconcile
>>>>>> std.algorithm with std.core.array.
>>>>>  If the language (D2++) will have a new way of iteration and ranges
>>>>> known and enforced by the compiler, then I expect Tango to support
>>>>> those at some point, and std.algorithm would presumably just work.
>>>>> However, if it is based on some interface, ad hoc (these methods must
>>>>> be present) or properly via an interface Range { }, I would expect
>>>>> Tango developers to be involved in the process of defining those
>>>>> interfaces (if Tango is meant to use/know about them). Since I have
>>>>> seen neither, it is somewhat difficult to make a well informed
>>>>> comment on the subject.
>>>>
>>>> It's been there for a while now (since 25 Nov 2008).
>>>>
>>>> http://www.digitalmars.com/d/2.0/statement.html#ForeachStatement
>>>>
>>>> Scroll down to "Foreach over Structs and Classes with Ranges". The
>>>> changelog reflects that too:
>>>>
>>>> http://www.digitalmars.com/d/2.0/changelog.html
>>>>
>>>> Version 2.021 mentions "Added range support to foreach statement."
>>>>
>>>>
>>>> Andrei
>>> 
>>> There is a typo in docs
>>> (http://www.digitalmars.com/d/2.0/statement.html#ForeachStatement):
>>> 
>>> Foreach Range Properties:
>>> .rear    return the rightmost element of the range
>>> 
>>> ...
>>> 
>>> for (auto __r = range; !__r.empty; __r.retreat)
>>> {   auto e = __r.tail; //<- tail or rear?
>>>   ...
>>> }
>>> 
>> 
>> Turns out Walter didn't like "rear" for a certain reason. :o) He did
>> take to my cute "toe" but in the end did not reflect that in the dox.
>> The following code compiles and runs:
>> 
>> struct S
>> {
>>      bool empty() {return true;}
>>      void next() {}
>>      void retreat() {}
>>      int head() { return 0; }
>>      int toe() { return 0; }
>> }
>> 
>> void main() {
>>      S s;
>>      foreach (e; s) {}
>>      foreach_reverse (e; s) {}
>> }
>> 
>> 
>> Andrei
> 
> toe() ?! tail() good, rear() not so good, toe() sucks.

I think I remember there being a discussion about this, but I wasn't aware that the outcome was this bad so let me qualify my opinion.

Only on humans (and possibly some apes) can toe be considered the other end, but even with humans the heel is more correct with the toes being a sort of peripherals. On most animals (and birds), the tail will be the other end of the head.

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango



More information about the Digitalmars-d mailing list