Phobos examples and auto
Marco Leise
Marco.Leise at gmx.de
Tue Nov 8 08:48:11 PST 2011
Am 07.11.2011, 13:18 Uhr, schrieb Steven Schveighoffer
<schveiguy at yahoo.com>:
> On Sat, 05 Nov 2011 20:53:25 -0400, Andrej Mitrovic
> <andrej.mitrovich at gmail.com> wrote:
>
>> On 11/6/11, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
>>> 2. If the user hovers the mouse over auto, display a tooltip with the
>>> auto-determined name
>>
>> That would scare people away when they see the name of a sophisticated
>> template instantiation. :)
>
> I would think the opposite.
>
> "whoa! auto makes it so I don't have to type all that junk? Awesome!"
>
> -Steve
Or "Omg! D's templates generates all this junk that can only be coped with
using auto?", hehe.
I remember when I first looked into std.algorithm _without_ any functional
programming background or reading Andrei's book. It was absolutely
incomprehensible to me, what these functions like 'filter' could return or
how I can make use of it. I wanted to put an array into it and get back a
filtered array. I imagined that the return value must be some obscure
language internal called a 'Result' and found no other way to use it
except for wrapping any functions from std.algorithm in another call to
array(...). Only recently I understood enough of CTFE to recognize that
the return values are still conventional structs offering an implicit
interface and no black magic. Now I quite like what is possible with - for
example - map in one line of code.
More information about the Digitalmars-d
mailing list