What is the correct use of auto?
Unknown W. Brackets
unknown at simplemachines.org
Sun Apr 13 14:48:38 PDT 2008
I might suggest using analogies that describe the people you're talking
to as your children aren't always going to help you. you have used a
lot lately.
Anyway, I don't mind that. Unfortunately, the problem here is your
analogy implies you're not interested in hearing arguments against your
position, which is unfortunate and hopefully untrue.
It is my belief that many people (at least this is true for me) learn
programming and new languages from examples and reference code. Not
using auto in examples just means I'm more likely to be confused when I
*do* see it (most likely with zero documentation or comments) outside of
an example. In addition, if I write code it's unlikely I'll use it,
*even though* it would make more code better, easier to read and type,
and more maintainable.
If you think that "auto" is a bad feature, I understand that. But using
it yourself, and omitting it from all documentation, is not helpful to
people trying to learn so much as you say.
-[Unknown]
Georg Wrede wrote:
> Unknown W. Brackets wrote:
>> Robert Fraser wrote:
>>> Actually, I would run it on all the Tango examples, since "auto"
>>> has no place in examples -- If I'm learning how to use an API, I
>>> want to know the actual types of the stuff I'm getting without
>>> looking up every function.
>
>> 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.
>
> The last phrase I entirely agree with. Replacing earlier "when your
> dogfood is good" with "when your dogfood is good for you".
>
> Now, what is different here is, there's another thing at issue here than
> how newbies/old hands should program. In other words, pedagogically,
> this is an exception case.
>
> Why? Well, here the point is not whether to encourage or discourage the
> use of "auto". The point is (in the examples which we're talking about,
> anyway), all of those examples TALK ABOUT SOMETHING ELSE than if you
> should use auto or not. So, to make the issue clear, one should have
> "unabridged" D code visible.
>
> I'm both sorry, and angry, over that I simply don't seem to express this
> more precisely, nor more convincingly -- sorry and angry with myself.
>
> Those of you who have kids, must have been in the situation where you've
> "known better, but can't say _why_ to your kids in such language and
> terms that they'd get convinced". I'm there now, with this issue.
>
> To sum it up, "auto" should /never/ appear in any example code (either
> here nor in DDJ), all examples that are not /directly/ associated with
> "auto" should simply not contain it. BUT, on the First Page of Proper
> Conduct in D, "auto" should be prominently displayed as the Proper Way.
More information about the Digitalmars-d
mailing list