| Anonymous | Login | Signup for a new account | 2013-05-22 02:28 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0005198 | OCaml | OCaml general | public | 2010-12-17 12:21 | 2011-05-17 16:57 | ||||||
| Reporter | lealanko | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | feature | Reproducibility | N/A | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | |||||||||||
| Target Version | Fixed in Version | ||||||||||
| Summary | 0005198: Allow sequential lets without "in" also in expressions | ||||||||||
| Description | This is the classic ocaml syntax pet peeve. Might as well make a feature request out of it, so if it gets rejected, there's an "official record" of it and no one need bother with it ever again. Other syntax issues aside, the most annoying ocamlism is the syntax for sequential lets, particularly the tailing "in". If one writes in an expression context: let foo = bar baz quux in let drokk = fnord fnarp zool in ... then the tailing "in" is visually indistinguishable from the preceding arguments if they are short variable names, and one is heavily dependent on syntax highlighting to clarify the structure of the program. Alternatively, if one writes let foo = bar baz quux in let drokk = fnord fnarp zool in ... then the structure is clearer, but the indentation is inconsistent. Of course one could give extra indentation to the first line, but that would require special tool support and it would look kind of weird. The neatest solution currently is: let foo = bar baz quux in let drokk = fnord fnarp zool in ... but that obviously wastes space quite a bit. It is strange that this sequential let construct, though ubiquitous in all ocaml code, is so cumbersome, whereas "let ... and ..." has a very nice syntax, although it is only needed in special circumstances where one needs to shadow several variable names at once. There is an obvious solution to this problem: just provide special support for sequential lets by allowing a let to directly follow a preceding let without an intervening "in": let foo = bar baz quux let drokk = fnord fnarp zool in ... This shouldn't cause any syntax ambiguities because the very same syntax for lets is already supported in module bodies! I'm inclined to suspect that this option has already been intentionally rejected for some reason because it is so obvious, but one can always hope. All the other syntax issues in ocaml are minor in comparison to this one. | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0005904) doligez (manager) 2011-05-17 16:57 |
This would be quite hard to parse with a yacc grammar because you need to look ahead all the way to the "in" keyword in order to differentiate between (as a module body) let a = 1 let b = 1 and let a = 1 let b = 1 in 1 |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2010-12-17 12:21 | lealanko | New Issue | |
| 2011-05-17 16:57 | doligez | Note Added: 0005904 | |
| 2011-05-17 16:57 | doligez | Status | new => acknowledged |
| Copyright © 2000 - 2011 MantisBT Group |