Skip to content

Exclude compiler generated args #3710

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

Closed
wants to merge 2 commits into from
Closed

Exclude compiler generated args #3710

wants to merge 2 commits into from

Conversation

forki
Copy link
Contributor

@forki forki commented Oct 8, 2017

This addresses #3705

image

Let's see what else we break ;-)

@forki
Copy link
Contributor Author

forki commented Oct 8, 2017

but this fails at wrong position ;-)

@forki
Copy link
Contributor Author

forki commented Oct 8, 2017

ok the "fix" is clearly wrong. It's matching the _ already because the nameres sees it as _arg1. It also matches the _arg1 in function body, but there is no way for me to see if we are in function definition or function body.

@forki
Copy link
Contributor Author

forki commented Oct 8, 2017

@dsyme do you think #3705 is a bug? If so I could try to pass down context info like we do in TypeChecker

@dsyme
Copy link
Contributor

dsyme commented Oct 9, 2017

Yes, it's a bug

@forki
Copy link
Contributor Author

forki commented Oct 9, 2017

the fix would be breaking...

@dsyme
Copy link
Contributor

dsyme commented Oct 9, 2017

the fix would be breaking...

I wouldn't mind that - it is obviously a bug and any code relying on this shouldn't compile - but we can explore ways to make it a warning if necessary

@drvink
Copy link
Contributor

drvink commented Oct 10, 2017

Since I was tricked by @forki ;) into #3706, I asked about solving this too, and he said that it's trickier than it seemed at first blush: not only does more state need to be threaded down to the point at which it would be most convenient to make the check as to whether the identifier was compiler-generated, but also, that state is replicated in other places, which means we would need to invalidate it everywhere else it exists.

I don't know enough about the compiler to know whether this is a stupid suggestion, but an easy (though somewhat a hack) solution would be to simply regard _argn as an invalid/reserved name within the parser--the idea being that we do not want users to be able to use it as an identifier, so it should cause a failure if we see it as user input, but post-parsing, the compiler would be able to introduce identifiers with such names for internal use.

Rationale:

  1. As long as this would not interfere with e.g. quotations or TPs, it seems like an OK solution for the time being
  2. We want to prevent this ASAP so that "clever" users cannot write code that uses it
  3. We want to do this ASAP to minimize the amount of breakage to existing code that does use it (if there is any)
  4. There are no (obvious) upsides to permitting the existing behavior

Anti-rationale:

  1. Parser seems like the "wrong" place to put it, since it's a valid token and (currently) a valid identifier, though I don't know if there's necessarily a better place, and we can still provide useful diagnostics if we make it a parse error

@forki
Copy link
Contributor Author

forki commented Oct 10, 2017

@drvink I think i found the "correct" way. now we need tons of samples ;-)

@KevinRansom
Copy link
Contributor

@forki,

Hi mate, what is the status of this?

Thanks

Kevin

@forki
Copy link
Contributor Author

forki commented Mar 17, 2018

Need to revisit

@KevinRansom
Copy link
Contributor

thx

@KevinRansom
Copy link
Contributor

@forki, do you intend getting back to this, or can this be closed?

@KevinRansom
Copy link
Contributor

@forki,

we like this work, however, in order to reduce the number of abandoned, but open PR's we are closing it. Feel free to reopen this PR or resubmit the change when believe you are able to complete it.

Kevin

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

Successfully merging this pull request may close these issues.

4 participants