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

Return String should be nullable, no? #309

Open
kevmoo opened this issue Sep 29, 2024 · 2 comments
Open

Return String should be nullable, no? #309

kevmoo opened this issue Sep 29, 2024 · 2 comments

Comments

@kevmoo
Copy link
Member

kevmoo commented Sep 29, 2024

external String operator [](String name);

CC @srujzs

@srujzs
Copy link
Contributor

srujzs commented Sep 30, 2024

This is similar to #181. The IDL claims the return type is non-nullable, but naturally it would be nice to coerce missing values to null instead of a cast failure. I'm not sure if the behavior is similar everywhere a getter is declared in the IDL to make that change. The current solution is using has to check for existence.

@rutvik110
Copy link
Contributor

I'm not sure if the behavior is similar everywhere a getter is declared in the IDL to make that change. The current solution is using has to check for existence.

From what I observed in the idl specs, the behaviour isn't consistent. Some getters are non-nullable while some are defined nullable. I don't know yet what determines that though.

But it would be nice to make this nullable as the users won't have to remember to check for the nullable case by using has, it would be explicit by the returned value from the getter. I could contribute to this issue if you could share what changes we might be looking towards fixing this issue beside just making this getter nullable.

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

3 participants