-
-
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
Let fun names and method calls start with Uppercase #4934
Conversation
This makes it possible to write a top level fun starting with an uppercase letter, but there is no way to call this fun: fun Top_Level_fun
puts "foobar"
end
Top_Level_fun # => undefined constant Top_Level_fun I think it's a good addition for fun in lib, but maybe not in top level. We could give a compile-time error when trying to define a top level fun like this, WDYT? |
@bew Good catch. Fixed! |
I strongly support this change :-) |
"| Disallow top-level funs that start with Uppercase" So no toplevel methods like the Integer and String factories in Ruby will be possible? Ok. How will uppercase methods compare against constants in name resolution? Say you have the following: class Foo
class X
end
def X
return Foo
end
def do_it
X.new
end
end
x = Foo.new.do_it which X is X? |
@yxhuvud This change only applies to lib |
@yxhuvud And if we ever allow that, |
I thought that this wasn't just |
Well, to be able to call funs with those names you have to allow uppercase in any call names, like in |
Note that it's method calls, not method definitions ;-) |
So for SDL we can have:
Previously, the compiler would require
fun
names to start with lowercase, and also method calls.This is a tiny change, but:
Of course
LibSDL.init
might be referring toSDL_Init
, butLibSDL.SDL_Init
is much more explicit. And in most cases these methods are wrapped and invoked once, so not much is saved by writingLibSDL.init
.For #4832 it means we can write
LibC.DuplicateHandle
andLibC.GetStdHandle
(and others).