PLEAC in Scala ... a start
Last December, I
whined to the Scala mailing list:
"... I miss having a concise syntax for Hash/map
literals, and for tuple literals."
Well, it looks like tuple literals were already in the works
at the time; they use braces instead of parens, but they're
otherwise just as concise I'd like them to be.
Map literals are slightly less directly baked into the
Scala syntax, but are still reasonably easy to specify.
It currently accepts, e.g.,
val tm = new TreeMap[String, int] + "abc" -> 1 + "xyz" -> 2
but only for immutable maps.
Martin suggested that we might see a slightly improved syntax like
new Map("abc" -> 1, "def" -> 2)
some time soon, possibly including a default kind of Map.
("If not, one would have to write
new HashMap("abc" -> 1, "def" -> 2)
I also mentioned that something that might
"... help with this kind of question would be a
"Programming Language Examples Alike Cookbook"
("PLEAC") page for Scala.".
Well, there followed much discussion of the map syntax,
but no one bit on the PLEAC angle.
So I started in on it, but it seems weird that the
sections are just plain code, so it's not so easy to tell
whether the code is correct (or even compilable).
I wrote some Ruby code to work that angle:
Much more to do on it, but it's a start.
Oh, yeah, and it depends on my old tdc_sh script to
do the date stamps
I described a few years ago.
I'll post the other pieces and my start at the actual
PLEAC Scala code, one of these days.