-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature Idea: Auto-prefix class
and enum
arguments.
#6067
Comments
@chris-huxtable I assume this would only work for providing literals in method args, i.e. given enum A
Foo
Bar
end
def foo(enum : A)
end you can call If so, then yes I think this is a simple, easy to understand semantic which should be fairly easy to implement (detecting ambiguity might be hard, i.e. |
it can also conflict with type resolution: enum Val
Foo
Bar
end
class Bar
end
def hello(value : Val)
end
def hello(bar : Bar.class)
end
hello(Bar) # hello(::Bar) or hello(::Val::Bar) ? I'd still prefer case insensitive symbols (i.e. |
I'd prefer "auto prefix" using symbols for enum only. |
I am interested in getting a little more involved with the actual compiler and have an idea which I think would be a big improvement to the use of
enum
s. If its thought to be a good idea I would appreciate some guidance on where it might be best to start.Currently when one submits an enum as an argument it needs to be something like
Process::Redirect::Close
. It could simply beClose
. The method is expecting aProcess::Redirect
. This produces long lines of repeated information;Process.run(...)
for example.I would like to modify the compiler to assume a prefix on a given
enum
orclass
as being that of the expected receiving kind.Thoughts?
The text was updated successfully, but these errors were encountered: