-
Notifications
You must be signed in to change notification settings - Fork 2
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
Explicit this
parameter
#84
Comments
A first implementation is provided in this. Problems:
|
Possible solution for problem 2: make Example marshals:
|
To solve problem 1, c0cf75b forces the arity of native functions to at least 2. This causes problems with methods of default prototypes, which are currently implemented as native nodes. For example, the
returns a
but it's definitely not intended. Default prototypes need to be reimplemented as semi-native nodes. This will also provide performance improvements as values won't have to be marshalled every time one of those methods is invoked. |
|
Reopening due to undesired side-effect:
|
This is actually intended, by design; and it would also behave like that with Lambda objects/methods. The field access operator binds the first argument of the method, so its arity is decreased by 1. I guess I have to get used to it. |
The main use case for lazy values is no-arg methods. No-arg methods actually have an argument, which is
this
. Expliciting that argument will allow for removal of lazy values, with immense advantages in terms of simplified implementation. It will also allow users to implement their own no-arg methods, which is currently impossible because there is no syntax to define lazy values.Syntax example:
This is quite easy to fix using the following steps:
this
a regular identifier rather than a keyword;Note that this actually makes it possible to call
this
with an arbitrary name. E.g.:This is not necessarily bad.
The text was updated successfully, but these errors were encountered: