The Strange Loop conference

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Sep 21 13:20:04 PDT 2011


On 9/21/11 2:29 PM, Timon Gehr wrote:
> On 09/21/2011 06:55 PM, Andrei Alexandrescu wrote:
>> I'm back from the Strange Loop conference. It's been an interesting
>> experience. The audience was very diverse, with interest in everything
>> functional (you'd only need to say "Haskell" or "monad" to get positive
>> aahs), Web/cloud/tablet stuff, concurrent and distributed systems.
>> Mentioning C++ non-mockingly was all but a faux pas; languages like
>> Scala, Haskell, Clojure, and Erlang got attention. The quality of talks
>> has been very variable, and unfortunately the
>> over-confident-but-clueless-speaker stereotype was well represented.
>>
>> I gave a talk there
>> (https://thestrangeloop.com/sessions/generic-programming-galore-using-d)
>> which has enjoyed moderate audience and success. I uploaded the slides
>> at http://erdani.com/d/generic-programming-galore.pdf and the video may
>> be available soon.
>
> I am looking forward to it!
>
>>
>> There was a very strong interest in D's CTFE abilities, which we should
>> consider a strategic direction going forward.
>
> One milestone would be to make DMD GC enabled. CTFE string manipulation
> sucks up too much memory.
>
>> Also finalizing D's
>> concurrency language and library infrastructure is essential. These two
>> features are key differentiators. Also, capitalizing on D's functional
>> features (which are e.g. better than Scala's but less known) would add
>> good value.
>>
>
> Where D still loses when compared to Scala is functional code syntax:
>
> val newcol = collection filter {x=>x<5} map {x=>2*x}

Yoda this wrote.

> or maybe
>
> val newcol = for(x<-collection if(x<5)) yield 2*x

Too baroque.

> vs
>
> auto newrange = filter!((x){return x<5;})(map!((x){return 2*x;})(range));

auto newrange = filter!"a<5"(map!"2*a"(range));

At first some people get the heebiejeebies when seeing string-based 
lambda and the implicit naming convention for unary and binary 
functions. More importantly, there's the disadvantage you can't access 
local functions inside a string lambda. We should probably add a 
specialized lambda syntax.

> I believe that is part of the reason why it is less known. If I write
> functional style code in D I unfortunately usually get feedback that it
> is "extremely hard to read". Furthermore, Scala has built-in tuples, and
> eg delimited continuations, which enable some more functional
> programming idioms. std.algorithm/std.range are also considerably (and
> as I understand, deliberately) underpowered for FP when compared to eg
> Haskell's standard set of libraries, and writing a good range from
> scratch is usually a serious undertaking.

I wonder what Scala/Haskell idioms we should borrow for D.

> Another big advantage that Scala has is that it supports pattern
> matching. It is usually about the first feature functional programmers
> care about.
>
> What do you think is the biggest advantage that Ds functional
> programming has in comparison to Scala's?

1. True immutability

2. True purity

3. Pass by alias

For a language that has so firmly branded itself as functional, Scala 
has a surprisingly poor handling of immutability and referential 
transparency aka purity. My understanding is that Scala's immutability 
merely consists of final values and a web of conventions. (Please 
correct me if I'm wrong.)


Andrei


More information about the Digitalmars-d mailing list