Re: Expression-local variables and 'let'
Daniel Bonniot <[email protected]> Fri, 20 Feb 2004 18:00:55 +0100
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Isaac Gouy wrote: >>After all, what matters is the abstract syntax. Tools should be able >>to understand and present you with the concrete syntax you personally >>feel more comfortable with. >> >> > >Isn't language design more interesting than that? >Less about preferences and comfort levels, more about providing >structures that buffer against slips and mistakes. > > I'm not saying syntax design is not interesting. I'm saying that there is more to language design than syntax design (there are the semantic constructs you provide, type checking, ...), and that the syntax part can be treated (mostly) independently from the rest. >Isn't part of what Nice is about safety? > > Yes. >IIRC one of the unsafe aspects of imperative languages is that it isn't >clear when we've changed the state - so we've had a whole slew of >single assignment languages. > >What was the objection to making single-assignment default? > > A question of priorities. Nice has a few strong points to make. One is that a powerful type system can be used in practice, and that it bring improtant benefits. There are other interesting type systems around, but Nice's is unique. A second is that multi-methods is a better approach than class-based OO. There are other languages with multi-methods, but no mainstream one, so this point is also an important one to make. Third, that this approach to "OO" fits particularly well with the functional paradigm. 2 and 3 taken together mean that you can basically get the best of both the OO and the FP world. There are other points, like a better object creation model, avoiding boiler-plate code like getters and setters (in preparation), contracts (just applying previous work here), and a few more. All these taken together are already quite a lot to digest for "mainstream". My goal with Nice is to demonstrate in practice that the above main points are worth learning about, and to provide a very pleasant language to work with. Now, we could discuss forever about the ideal form of every single detail of a language. The problem is that there are many cases where an objective ideal is not something people will agree on, or where that ideal might be only a minor improvement over a much more known practice, in which case experience shows that it will probably not catch on. In those cases, I think it's the best choice to stick with something people are familiar with, or will easily relate to, unless there is a compelling reason not to do so (that's how new main points can be added to the list). This approach ensures that we don't hide our main points behind details which will cause pain to many users, and repell many others. Changing the default mutability status, for instance, seems to me to fall into this category. It might be a slight improvement, but the benefits would not be huge, especially as you kep both option (single assignment languages or pure functional languages are the ones that really explore a different way here). Anyway, with let and var, there is no default anymore, so you can just express your intention. Going back to generalities, I understand that this pragmatic approach can frustrate some people (those who speak up ;-) who already got the main points, who have a large culture about programming languages, and who would like more radicality. The thing is, we also need to keep the general picture in mind. I'd prefer a language that brings novel and little-known ideas to a larger community (which itself brings the perspective of more libraries, tools, ...) than a "perfect" language that will appeal to very few because it's too big of a step for most people to make. This might be were an alternate syntax comes in, if really this is an important issue to some. I'm not opposed to breaking conventions. I just want to make sure the benefit is clearly worth the extra "peculiarity". Daniel ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click