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

Revert "Allow parameters passed to GDScript functions to be nulled" #37318

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

ttencate
Copy link
Contributor

This reverts commit f0efc75.

Fixes #37312.

@akien-mga
Copy link
Member

By reverting #26528, you'll reintroduce #26047, no?

@ttencate
Copy link
Contributor Author

ttencate commented Mar 26, 2020

@akien-mga No, the error messages have improved considerably since then. See #37312 (comment).

Edit: bother, for that particular test project posted on #26047, the error message is still the same confusing thing. Please hold while I investigate...

@ttencate
Copy link
Contributor Author

I'm guessing it's something to do with signals vs. function calls, but I can't for the life of me figure out how to hook up signals in the 4.0 way despite having read Juan's update. None of these work:

signal my_signal

my_signal.connect(self.handler) # Nope, the identifier "my_signal" isn't declared in the current scope
connect("my_signal", self.handler) # Nope, invalid get index 'handler'
connect("my_signal", self, "handler") # Nope, assigned type 'self' doesn't match the function argument's type (Callable)
connect("my_signal", Callable(self, "handler")) # Nope, "no constructor of 'Callable' matches the signature 'Callable(self, String)'

@ttencate
Copy link
Contributor Author

I've already spent more time on this than I should have, and the rabbit hole is deeper than I expected.

I think having a confusing error message is much better than silently nullifying arguments, so in my opinion this PR is still an improvement over the status quo. But if everyone shared that opinion, the nullifying would never have been added in the first place.

I'll leave this PR open for discussion.

@vnen
Copy link
Member

vnen commented Apr 21, 2020

I think this is correct, we should revert the change. It should not silently convert the value to null. We need to find a way to improve the error message.

@vnen
Copy link
Member

vnen commented Apr 21, 2020

I just noticed that I was the one who merged this. I guess I didn't fully understand the consequences back then.

@akien-mga akien-mga merged commit 6aac75a into godotengine:master Apr 22, 2020
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Statically typed function argument silently converted to null if the type doesn't match
4 participants