-
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
The same method is dispatched for instances of a type and the Atom representing the type #1538
Comments
I did not put the breaking/non-breaking label because I think that highly depends on the chosen solution. |
Two issues:
The fix:
|
I've just run into this again. It's annoying. |
Updated the issue to point to the broader underlying issue. As also discussed at https://discord.com/channels/401396655599124480/955900131197194332 it would be good if we could see how the new typesystem design influences this issue and if it takes it into account at all (as it may be worth considering, because the current behaviour is unintuitive and leading to issues as the one reported here). |
This is just a quick fix addressing an issue which was making debugging problematic. The proper solution to the broader issue described at #1538 (comment) still needs to be done.
This issue still persists (although it changed a bit), I just ran into it today when the test suite crashed trying to display a To reproduce it, run:
it currently prints:
As we can see, we cannot rely on As we can see in this example, this already works correctly for atoms that rely on the default I think the correct solution here would be to ignore the override in static mode, a bit like we are doing for atoms without an override. If we are dispatching on a Type and not an Atom Instance, we should probably just keep the default behaviour. This makes handling of the |
The recent @radeusgd endeavor seems like the same problem as reported by me two weeks ago: yes, the inability to use |
Is this valid? I can see that: from Standard.Base import all
type Bar
Bar foo
to_text : Text
to_text self = self.foo.to_text
main =
foo = Bar.to_text
IO.println foo prints |
The current issue
The (old) deeper issue
An example of the deeper issue is that the
to_text
method dispatches to the sameErrorToTextNode
both for theDataflowError
instances and for theError
Atom which is their 'type'. We should probably be able to dispatch differently.As @iamrecursion pointed out:
This may need to be updated based on updates to the typesystem design too.
The original bug
A
ClassCastException
from withinGetFieldNode
is exposed to the user.Steps to Reproduce
Expected Result
Not really sure, since we have this weird semantics of static methods (i.e. that extension methods defined on a type are applicable not only on its atoms but also on its constructor).
Certainly the code should not expose such an internal error.
It seems reasonable for the constructor to have its own
to_text
that would print the name of the constructor, although that is likely not going to interact well with the 'static methods semantics' that we have.I'm not aware of any documentation regarding semantics of this kind of static methods, so I think it should be documented (and possibly redesigned if necessary). If the current design of static methods (which is very weird) is to stay, I think referencing
this
in a call that is resolved on an atom constructor should probably throw some intuitive error.Actual Result
Enso Version
The text was updated successfully, but these errors were encountered: