Skip to content
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

Function parameters are case-insensitive #344

Open
exodustx0 opened this issue Dec 31, 2024 · 2 comments
Open

Function parameters are case-insensitive #344

exodustx0 opened this issue Dec 31, 2024 · 2 comments

Comments

@exodustx0
Copy link

asar 1.90
function Foo(bar) = BAR
print dec(Foo(42))

This prints 42. While the fix for this is relatively simple (replacing stribegin() with strncmp() in asar_call_user_function()), it would be a breaking change. Similarly:

asar 1.90
function Foo(bar, BAR) = 123
print dec(Foo(1, 2))

This prints error: (Eduplicate_param_name): Duplicated parameter name: bar in creation of function Foo [function Foo(bar,BAR) = 123]. This is an even simpler fix (replacing stricmp() with strcmp() in createuserfunc()), and isn't breaking, but depends on the first issue being fixed.

@p4plus2
Copy link
Collaborator

p4plus2 commented Dec 31, 2024

I'm fine by fixing this for 2.0, but i think in 1.9 (if we do another minor release) adding a warning for case 1.

It may be minor enough to just be a drive by fix though.

@exodustx0
Copy link
Author

exodustx0 commented Dec 31, 2024

The 1.9 case 1 warning, would it after warning fall back to old behaviour? If so, I would also throw a warning in case 2 about how what the user is trying should work but cannot, due to the case 1 bug, and then also fall back to old behaviour: if a user defines function Foo(bar, BAR) = ..., and case 1 is not fixed but only warned over, BAR would be inaccessible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants