What is the correct use of auto?
Robert Fraser
fraserofthenight at gmail.com
Sat Apr 12 18:11:38 PDT 2008
BCS wrote:
> Reply to Robert,
>
>> Unknown W. Brackets wrote:
>>
>>> I completely disagree. Especially when your dogfood is good, you
>>> should share it and not horde it for yourself.
>>>
>>> Teaching newbies to program differently than you think is best seems
>>> wrong to me.
>>>
>>> -[Unknown]
>>>
>> I was thinking of "newbies to the library" instead of "newbies to the
>> language". It's good practice in the language, but I remember trying
>> to use a Mango servlet and spending an hour looking up what types were
>> returned by functions in examples so I could figure out how to extend
>> & change the example code.
>>
>
> quick, ugly (and slightly profain).
>
> template WT_TypeIsThis(T)
> {
> pragma(msg,T.stringof)
> }
>
> use like this:
>
> WT_TypeIsThis! (typeof(someFnc()); // man I like D's template
> Syntax!!!!!!!
Indeed that works. These days, I'd just load it up in Descent & hover
over it to find out :-). But back when I was first learning D, I didn't
know the template method and IDEs weren't mature enough for that yet.
More information about the Digitalmars-d
mailing list