Justin Johansson:

> I am wondering, though, from an OO/polymorphism perspective, and UML and 
> sound software engineering perspective as well, what does D's auto keyword 
> buy you except (perhaps) laziness (in keystrokes)?

In functional/generic code you sometimes end having very complex types (what 
comes out of a lazy chain of a lazy filtering of a lazy mapping of some lazy 
generator, for example), in such situation having a bit of type inference saves 
you a lot. And then you give this monster to other templated functions, that 
are able to work with any iterable (Range, in Phobos2), so there's no a huge 
type signature anywhere.


> In some ways, as I said above, I miss "D auto" in C++; but then again, when I 
> explicitly write the exact same type as the function return signature says, I 
> feel more in control of my software design.

Yes, an over-usage of "auto" makes the code a bit less self-descriptive (this 
sometimes can be negative, so as with most features of a language you don't 
have to abuse it), but if you use dynamic languages you get used to that :-)


>btw. 20 years ago I thought the Forth language was fantastic.  Then later I 
>learned the difference between programming-in-the-small and 
>programming-in-the-large.<

The name of the recently developed Scala language means scalable language. It 
recognizes the need for both scaling up (what you are talking about here, that 
Java and especially Ada give you) and scaling down (what dynamic languages like 
Python sometimes give you). Both things are important, because a programmer has 
to write programs of all sizes, not just huge ones and not just small ones.


>I was wondering about a subject line like "what's the best thing about D",<

I don't know. Probably the community around it. Walter is a bit like a bear 
sometimes, but still the community grown around his language is alive, despite 
its small size. Andrei has improved it some more.


> btw. Do any other languages have an "auto" var idiom?  I don't remember Scala 
> having such (and it's really modern), though perhaps my memory lapses.

In C# it's named "var" that's one char shorter :-) Other languages have 
something similar, a local form of simple type inference.

Bye,
bearophile

Reply via email to