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

Non indexable objects #217

Open
softmattertheory opened this issue Mar 22, 2023 · 1 comment
Open

Non indexable objects #217

softmattertheory opened this issue Mar 22, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@softmattertheory
Copy link
Contributor

Describe the bug
Classes that don't provide index and setindex should raise errors if you try to index them.

To Reproduce
// check index
class A {
}

var b = A()
print b[0] // expect error

Expected behavior
Should raise an error; presently returns nil

Additional context
Add any other context about the problem here.

@softmattertheory softmattertheory added the bug Something isn't working label Mar 22, 2023
@softmattertheory
Copy link
Contributor Author

Currently, all classes provide index and setindex because they inherit from Object. It may perhaps be useful to have an ImmutableObject class, but that feels like a separate issue.

But there is still a problem here:

print b["hello"] 

does raise a 'ObjLcksPrp' error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant