Re: Expression-local variables and 'let'
[email protected] Sat, 21 Feb 2004 13:24:17 -0600
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
Quoting Daniel Bonniot <[email protected]>: > We should also be careful about applying a _numeric_ mesure of the > complexity of the text to the original program. For instance, does that > mesure only account for the structure, or does it take into account > length too? Programming languages are more concise, so a level of > nesting that is not acceptable in natural language might be in a PL. I > don't think two levels of 'if' are common when speaking, while they are > in code, for instance. I agree. I was just pointing out that our intuition about which one is more readable is probably not what we should measure readability by. I chose that particular numerical measurement as an example because I happened to remember that MS Word has that feature. If we really wanted to, we could create two syntaxes for Nice and then determine empirically which syntax is prefered by users of Nice via experimentation. > >I don't think you can implement 'while' as a user-defined function with the > same syntax since 'while' needs to be able to evaluate the expression in the > >parentheses multiple times. > > > You can call the body multiple times. 'foreach' is implemented in > nice.lang, for instance. > Am I missing something? Yes, you can execute the body multiple times but you can only execute the condition once. The type of a 'while' function would be: (() -> bool, () -> ()) -> () But, the calling syntax only works for a function of type: (bool, () -> ()) -> (). > Right. But this means that given the choice between 'let .. in' which > solves better this "local scope" problem and offers some support for the > "binding arguments" situation, and expression-local variables, which are > tailore for "binding arguments", given that there is already a good > enough way to handle "local scopes", I'll chose the latter, because the > ration benefit/peculiarity is higher. Okay. - Brian ------------------------------------------------------- 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