GIGO: words unreadable aloud
Mishrogo Weedapeval
 

 

  Monday 5 February 2007
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 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: http://got.net/~landauer/sw/rip_it_up.rb

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.
11:21:15 PM   comment/     



Click here to visit the Radio UserLand website. Click to see the XML version of this web page. © Copyright 2007 Doug Landauer .
Last update: 07/3/1; 22:37:59 .
Click here to send an email to the editor of this weblog.

February 2007
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28      
Jan   Mar

Previous/Next