Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solutions for the non-printable generated names #6746

Closed
vicuna opened this issue Jan 8, 2015 · 3 comments
Closed

Solutions for the non-printable generated names #6746

vicuna opened this issue Jan 8, 2015 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Jan 8, 2015

Original bug ID: 6746
Reporter: @Drup
Assigned to: @mshinwell
Status: assigned (set by @damiendoligez on 2017-02-24T12:27:41Z)
Resolution: open
Priority: normal
Severity: feature
Category: typing

Bug description

There are several generated non-printable names produced by the typechecker. It would be quite useful to avoid them.

I know about:

  1. *opt* for optional arguments (and I think that's all.
  2. *predef* to avoid shadowing. Seems to be used only for optional arguments and only for Some and None now.
  3. *extension*
  4. *sth* Also related to optional arguments ?
  5. *undef*

I don't know the exact use for the last 3.

For 2. I suppose #5849 would do the trick.

For 1. Currently let f ?y:(x=3) () = x result in the following equivalent source:

let f ?y:( *opt* )  =
  ((let x =
      match ( *opt* ) with
      | ( *predef* ).Some ( *sth* ) -> ( *sth* )
      | ( *predef* ).None  -> 3 in
    fun ()  -> x)[@#default ])

It seems to me using x instead of *opt* would work here, including when the name x is repeated (it would work as well for let f ?(x=3) x ...).
If I understood correctly, *opt* is recognized later on for code emission. An attribute, as #default, could be used here.

It's much easier to drop non-printable attributes in the printer than to change the names, especially since the semantic doesn't change (except maybe for effectful code...).

@vicuna
Copy link
Author

vicuna commented Jan 9, 2015

Comment author: @mshinwell

For what it's worth, I've thought about fixing opt since it causes optional arguments to not have the correct names in gdb. I'm in support of working towards trying to remove at least some of these special names.

@vicuna
Copy link
Author

vicuna commented May 6, 2015

Comment author: @mshinwell

This doesn't seem like an immediate bug, so I think we should defer it until after 4.02.2.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants