-
Notifications
You must be signed in to change notification settings - Fork 326
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
Wip/mk/statics #3740
Wip/mk/statics #3740
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only checked the Enso stuff - looks a good place for us to work from.
foreign js my_method self = """ | ||
return this.a + this.b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The self
feels odd - I thought we had a special case for this
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we do? It doesn't work anyway, should be tackled in a separate issue if you think we need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No special cases for JavaScript outside of EpbLanguage
, please!
} | ||
|
||
@Specialization | ||
Text doType(Type type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meta.get_constructor_name
works on Type
!? Is the get_constructor_name
still correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left for backwards compatibility – optimally we should get rid of this, but there is still code in the stdlib that depends on some things being atoms.
@@ -158,7 +158,7 @@ private void generateQualifiedAccessor() { | |||
null, | |||
new FunctionSchema( | |||
new ArgumentDefinition(0, "self", ArgumentDefinition.ExecutionMode.EXECUTE))); | |||
definitionScope.registerMethod(definitionScope.getAssociatedType(), this.name, function); | |||
definitionScope.registerMethod(type.getEigentype(), this.name, function); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is eigentype? Own type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the type of this type – where statics live. If you can think of a better name, we can switch
@@ -170,4 +227,16 @@ boolean isNull(@CachedLibrary("this") InteropLibrary self) { | |||
public String toString() { | |||
return toDisplayString(true); | |||
} | |||
|
|||
public Type getEigentype() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There already is Type getType()
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that is for library usage, and given this is already a type, and there's also it's supertype, I want to be super clear with the getters.
Pull Request Description
Makes statics static. A type and its instances have different methods defined on them, as it should be. Constructors are now scoped in types, and can be imported/exported.
Important Notes
The method of fixing stdlib chosen here is to just not. All the conses are exported to make all old code work. All such instances are marked with
TODO Dubious constructor export
so that it can be found and fixed.Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.