We’ve always claimed that Grace’s design would be provisional, especially early on, and that we were after feedback on the design, both here on the blog, and at workshops or events we were attending.
Last weekend we held couple of workshops in Darmstadt and London. Participating were Jonathan Aldrich, Gavin Bierman, Sophia Drossopoulou, Susan Eisenbach, Erik Ernst, Dick Gabriel, Theo D’Hondt, Carsten Kolassa, Michael Kölling, Dirk Riehle, Lawrence Tratt, Andrew Black & James Noble. They were workshops, work was done, which will result in an updated spec soon. The largest changes we’re contemplating are:
- Requiring curly braces for all blocks. Because braces delay evaluation, they are semantically as well as syntactically important. Requiring braces will make this clearer to novices. Code layout must still be consistent with bracketing, and layout will still be used to elide semicolons. This means that Grace code will look more like Scala and Java and less like Python or Haskell.
- Operator precedence for arithmetic operators only (+,-,*,/). All other operators will have no precedence, working left-to-right. Operators without precedence will still require explicit parentheses.
- A streamlined class declaration and initialisation protocol that will soon be a topic of a blog post.
plus a range of minor changes, generally simplifying Grace by choosing just one option where we had been considering allowing programmers’ choices. Especially for novices, every option adds complexity to a language and makes it harder to learn, so we’re trying to purge unnecessary options from the design.
Since you guys requested comments, I guess I’ll give some, even though it might be a bit too late.
* Braces seem to be cruft left over from a bygone era of computing. The only time I’ve found them really useful was when I needed to enter a JavaScript function through the location bar of my browser a number of years ago. But today, Firebug eliminates the need for hacks like that in my daily life, though braces still persist in my JS code.
* I somehow don’t see the appeal of static typing, especially when the goal is to teach an introductory CS class. I went through an intro CS class that used Java with a library that made things more user-friendly. It was a lot of fun, but a good bit of the ideas we had to learn and the errors we had to debug had to do with limitations that static typing puts on expressiveness, and the burdens it puts on programmers.
Using a dynamic language would have been far more intuitive, and I don’t think intuitiveness gets as much praise as it deserves. There’s a reason we teach arithmetic talking about numbers without having to talk about recursively defined sets.
* The final objection is one for which I’m most interested to hear your responses. It’s come up in a number of conversations I’ve had about the Grace project. Not to beat around the bush: why not just use Python? It doesn’t have braces, and as far as I can see that’s a plus. It isn’t statically typed, but as far as I can see that only affects performance (which you explicitly said wasn’t a goal for Grace) and possibly makes it difficult to do software in the large as well (though the developers at Yelp might disagree).
It seems like Python is more intuitive and thus faster and easier to learn. And if Python doesn’t seem object-oriented enough, why not use Ruby? They also have the inherent advantage of being stable, developed languages with large standard libraries and even more extensive special-purpose libraries.
Of course, Grace does look like it would have some very nice features, like pattern-matching (which is pretty limited in Python), object instantiation, not needing to use self when referring to instance variables, and nicer handling of concurrency/parallelism (at least I thought so, but I can’t seem to find anything about it in the initial spec). It’s just that, nice as these features are, I feel that learners would be better served by Python as far as I can tell.
Hi Maksym
yes we do want comments: thanks for yours!
a few brief responses:
Braces: yep, I’m not entirely happy with bringing braces back – the example code we’ve got looks messier with them there. But they do have the advantage of making everything clearer – and most of the languages we hope Grace moves people on to (Java, C++, C, JS I guess) all use braces. Ruby and Eiffel too, but with keywords rather than “}”.
Static typing: We don’t want to tie Grace to a particular pedagogy. Some people want to begin with static types, some without, some (perhaps increasingly common) would like to begin without types and them move to writing typed code (e.g. 1st semester Python, 2nd semester Java). We hope Grace will support all these approaches.
Yes Python and Ruby and Java and Eiffel and Scala and Racket are all here and have installed bases and good libraries – but there are also reasons why we are not set on any of them. At least, we’d like to try another alternative.