Original bug ID: 6246 Reporter:@ygrek Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:25:24Z) Resolution: fixed Priority: normal Severity: feature Version: 4.00.1 Fixed in version: 4.02.0+dev Category: ~DO NOT USE (was: OCaml general) Monitored by:@gasche@diml@hcarty
With the advent of the new warning 35 (unused for-loop index) it becomes natural to want this..
The text was updated successfully, but these errors were encountered:
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)?
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.