Scala collections

Timon Gehr timon.gehr at gmx.ch
Fri Jun 17 19:35:32 PDT 2011


bearophile wrote:
> Timon Gehr:
>
> > I'm hardly halfway through, but I think we need to steal some Scala features
> > sometime! =)
>
> The most important features of Scala are in its refined type system. The things
you underline aren't the most important ones.

I just underlined features I am somewhat missing from D. I think templates and
CTFE can be used to build complex systems more easily than by using the caps of a
refined type system. But I am definitely going to look into it. Apparently, it
provides VERY nice means to define beautiful syntax in a library!

>
>
> > "var"/"val" are very short names for often used keywords. (not too descriptive
though)
>
> In origin it was "invariant", then we have asked for "immutable", but now I like
val better because it's shorter. I have seen D code use more "const" maybe just
because
> "immutable" is a longer word.

=(. Well, definition blocks help somewhat:
immutable{
    int a=8383,b=foo();
    bool c=true;
}

>
>
> > List comprehensions. Is it maybe possible to get equivalent functionality and
> > conciseness in a library solution?
>
> List comps are good to improve psychological chunking. In dlibs1 I have a select
that apes them, but we are not there.
>
>
> > Simple pattern matching (bearophile's well-known tuple unpacking sugar)
>
> Scala pattern matching is far more than just unpacking tuples. But currently I
don't miss it a lot.

Yes, I only miss the most basic features too.

>
> Bye,
> bearophile

Cheers,
- Timon


More information about the Digitalmars-d mailing list