On Sat, 21 Jul 2012 18:24:04 -0400 Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:
> On 7/21/12 6:16 PM, Nick Sabalausky wrote: > > Yea. I used Java in college and ever since then I've been a fan of > > non-verbose systax - ie syntax that's the *opposite* of Java ;) > > On slide 19 of the OSCON slides there's this sample: > > auto s = ["abc", "a", "xz"]; > auto m = s.argmin!((x) => x.length); > > People in the audience were quite pleasantly surprised to figure that > although there's no mention of a type, that code is all the compiler > needs to figure there's a lambda that takes a string and returns an > unsigned integer etc. > Exactly. And what many people (depressingly) don't realize, is that dynamic typing (or OO boxing) is NOT needed to achieve that. I was actually impressed with that slide, too, but for a different reason: I've come across need for a function like argmin on occasion, but I didn't know it existed (Don't recall if it was actually in D, may have been another language I was using). That really is a fantastically useful function.