On 02/23/2011 01:15 AM, bearophile wrote:
Nicholas:
auto a = obj.method( "guess what i'm returning" );
I like auto. I use it sometimes. But it's not always clear what's taking
place in the examples. I believe you should exclude auto from all examples
except when explaining auto.
Unfortunately this happens in normal code too, not just in examples. auto is
practically necessary when you use lazy iterables, because their type is
usually too much complex to write, but in the other cases it obfuscates the
code a little.
In dynamic languages it's like using auto everywhere. But programmers of dynamic
languages survive because they program in a way that makes the implicit types a bit more
easy to guess :-) D code that uses "auto" a lot needs to be written in the same
way, with very well chosen variable names, etc.
???
unittest {
auto a = [1,2,3];
auto x = map!((i) { return i+1; })(a);
writeln(typeid(x));
// --> test.__unittest3.Map!(__dgliteral1,int[]).Map
}
There's no such type in any dynamic language I know of ;-)
Denis
--
_________________
vita es estrany
spir.wikidot.com