Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006246OCaml~DO NOT USE (was: OCaml general)public2013-11-26 05:382015-12-11 19:25
Assigned Tofrisch 
PlatformOSOS Version
Product Version4.00.1 
Target VersionFixed in Version4.02.0+dev 
Summary0006246: `for _ = e1 to e2` syntax is not allowed
DescriptionWith the advent of the new warning 35 (unused for-loop index) it becomes natural to want this..
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (administrator)
2013-11-26 06:48

Makes perfect sense.
frisch (developer)
2013-11-26 14:44

You probably know it, but the warning can be silenced by using an identifier starting with "_". And "__" (double underscore) is such a valid identifier. But yes, indeed, it makes sense to allow "_" as for-loop index.

Users might expect that a context which allows both an identifier and _ would also support any pattern. Should we accept syntactically (and represent in the Parsetree) any pattern and reject those outside "_" and identifiers in the type-checker, or restrict the parser and Parsetree to only identifier and _ (represented as an "string loc option" in the Parsetree)?
gasche (administrator)
2013-11-26 15:00

I think rejecting in the type-checker would be best.
doligez (administrator)
2013-11-30 22:56

I think accepting any pattern is just adding useless complexity to the compiler.

Also, why "string loc option" and not "string option loc" ?
frisch (developer)
2013-12-02 19:04

Commit 14330 on trunk. The parse accepts any pattern, and the type-checker fails on non-supported cases. I think this makes the Parsetree more self-documented (representing "_" as None would deserve some explanation) without really adding any kind of complexity. And one can imagine uses of other kinds of patterns by "extension expanders" (-ppx rewriters), such as list-comprehension stuff.

- Issue History
Date Modified Username Field Change
2013-11-26 05:38 ygrek New Issue
2013-11-26 06:48 gasche Note Added: 0010664
2013-11-26 14:44 frisch Note Added: 0010665
2013-11-26 15:00 gasche Note Added: 0010666
2013-11-30 22:56 doligez Note Added: 0010683
2013-11-30 22:56 doligez Status new => acknowledged
2013-12-02 19:04 frisch Note Added: 0010687
2013-12-05 09:35 frisch Status acknowledged => resolved
2013-12-05 09:35 frisch Fixed in Version => 4.02.0+dev
2013-12-05 09:35 frisch Resolution open => fixed
2013-12-05 09:35 frisch Assigned To => frisch
2015-12-11 19:25 xleroy Status resolved => closed
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker