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

Clarify access to a non-existent Object member #596

Closed
jdidion opened this issue Dec 11, 2023 · 3 comments
Closed

Clarify access to a non-existent Object member #596

jdidion opened this issue Dec 11, 2023 · 3 comments

Comments

@jdidion
Copy link
Collaborator

jdidion commented Dec 11, 2023

Currently the spec does not state whether accessing an object member that does not exist results in a None or an error. E.g.

Object foo = object { a: 1 }
Int b = foo.b  # what happens here??

I suggest that the result should be a None, since there is currently no way to check the existence of an Object member.

@rhpvorderman
Copy link
Contributor

I suggest an error.

input:
  my_optional_string=foo.b

Should throw an error when b does not exist, rather than silently putting in a None.

@jdidion
Copy link
Collaborator Author

jdidion commented Dec 12, 2023

That's a good point - I would expect an error in that case.

Maybe we can have contains_key() (#305 ) accept either a Map or Object?

@patmagee
Copy link
Member

I am in favour of an error as well with a preference for using the contains_key function. Most languages raise some sort of access error when you are trying to do a direct access and the key does not exist

@jdidion jdidion added this to WDL v1.2 May 15, 2024
@jdidion jdidion moved this to Todo in WDL v1.2 May 15, 2024
@jdidion jdidion moved this from Todo to In Review in WDL v1.2 May 17, 2024
@jdidion jdidion closed this as completed May 20, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in WDL v1.2 May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants