-
-
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
Bug: main
function conflicts with main
fun
#4761
Comments
To reproduce:
|
Looks like your A minimal sample to reproduce doesn't even to call def main(options, arguments : Array(String))
end |
At the very least we should have a nicer error message for this. |
Yes, the parser could prevent to define a method named |
main
function conflicts with main
fun
#codetriage There's still some bugginess around this in 0.26.1
|
I think we need to use a different name for |
The compiler shouldn't assume the |
Yes. What I'm saying is, there's no need to use main for the C function. It's more common to define a main top level method. Or, put another way, no other language prevents you from using main (or any other non keyword name) as a name. |
If you want to change the symbol mangling so that |
I actually see no problem with not being able to define |
I was thinking that maybe top-level |
I like the idea of another namespace for toplevel funs, but not with adding them to LibC, since the manually defined functions are usually not related to libc. Note: A "long" module name is not a problem I think, because those functions are usually not called by crystal code (or very occasionally). |
We removed I like that as-is. |
@RX14 As-is generates the error linked above in #4761 (comment) |
Yes. The error should be improved. But I don't think the ability to define a top-level |
I think the easiest solution is to disallow overriding We can consider some options to disambiguate with mangling as a next step. But I don't really see too many good reasons for that. |
I tried out an old project and got a rather strange error.
The project is bindgencr. Unfortunately I don't really know what the root cause of the bug / error is, but (at least on my system) it can be easily reproduced by downloading the rep. and running the sample code.
Here's an example:
I've tried running it with the
--prelude=empty
flag, but that gives out the same output as before.My setup info:
The text was updated successfully, but these errors were encountered: