You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7029 Reporter:@bobzhang Assigned to:@garrigue Status: closed (set by @garrigue on 2016-12-13T00:34:17Z) Resolution: duplicate Priority: normal Severity: feature Category: ~DO NOT USE (was: OCaml general) Duplicate of:#4904
Bug description
It feels a bit weird that this code works in OCaml
let f x x = x
I am not sure that if we have a use case of duplicate parameters? The motivating example is that for the javascript backend, I would like to provide a guarantee that all names of parameters are preserved(which is very useful for stacktrace and debugger), however, ES5 strict mode does not allow duplicate parameters, it would be nice that OCaml is stricter than Javascript : )
The text was updated successfully, but these errors were encountered:
Having a warning in that case would be fine, and it could be enabled by default¹. I'm not convinced it is a good idea to make it an error, as it could break code for no excellent reason.
¹: such code always raises warning 27, "unused variable", but this warning is not enabled by default as it would be too noisy for some codebases.
The reason this should remain allowed is that it is a natural consequence of currification: "let f = fun x -> fun x -> x" shadows a first variable of name "x" with another of name "x".
I am not convinced by the use-case: when you generate the Javascript, you can check if the variables have the same name, and change the name of the unused one (to "x_unused_1", anyway, you won't need to debug it, as it is unused).
Original bug ID: 7029
Reporter: @bobzhang
Assigned to: @garrigue
Status: closed (set by @garrigue on 2016-12-13T00:34:17Z)
Resolution: duplicate
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Duplicate of: #4904
Bug description
It feels a bit weird that this code works in OCaml
let f x x = x
I am not sure that if we have a use case of duplicate parameters? The motivating example is that for the javascript backend, I would like to provide a guarantee that all names of parameters are preserved(which is very useful for stacktrace and debugger), however, ES5 strict mode does not allow duplicate parameters, it would be nice that OCaml is stricter than Javascript : )
The text was updated successfully, but these errors were encountered: