-
Notifications
You must be signed in to change notification settings - Fork 8
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
fe: add possibility to omit .type.
#2631
fe: add possibility to omit .type.
#2631
Conversation
michaellilltokiwa
commented
Feb 28, 2024
- I have read and accept the Tokiwa Software Fuzion Contributor Agreement.
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.
Looks great!
Will have a detailed look into it tomorrow.
…ype features. also added comments and a test showcasing an issue of ambiguity
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 am very happy with this PR! Espacially, I think I could use some of this to later permit feature declarations to serve as type aliases, which also requires converting calls into types.
* @param feat the outer feature this type is declared in. Lookup of | ||
* unqualified types will happen in this feature. | ||
*/ | ||
AbstractType tryResolve(Resolution res, AbstractFeature outerfeat) |
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.
Would be nice to avoid code duplication by adding a method
resolve(Resolution res, AbstractFeature outerfeat, boolean justTry)
and call this both by resolve
and tryResolve
.
|
||
type.a => 4 | ||
|
||
# NYI should result in an error: Duplicate feature declaration or similar. |
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.
We can solve this later, but here are my thoughts:
A duplicate feature
is a bit difficult to define when you take visibility into account.
I prefer to cause an error at an ambiguous call and to provide a means to disambiguate the calls:
ex is
a => 3
type.a => 4
say ex.a # should cause an error, ambiguous!
To make a call on the type feature, one could write
say ex.type.a
It is a bit harder to make a call on the instance, one ugly solution might be a temp field:
temp := ex
temp.a
Nicer might be to add an instance
(or self
, me
, thiz
) to Any.fz
public Any ref is
...
public instance => Any.this
then we might be able to do
say ex.instance.a
- add comment to logic `... && f.outer().isTypeFeature()` - fix indent - revert .type. replacement in two tests.
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.
please create 2 issues for my unresolved comments.