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

Clean up frozen-instance code #35

Open
Technologicat opened this issue Sep 25, 2019 · 0 comments
Open

Clean up frozen-instance code #35

Technologicat opened this issue Sep 25, 2019 · 0 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@Technologicat
Copy link
Owner

Technologicat commented Sep 25, 2019

See dataclasses, new in Python 3.7. (This pretty much fills the same role as MacroPy's case classes.)

We could raise dataclasses.FrozenInstanceError where appropriate.

Also, e.g. unpythonic.llist.cons doesn't need the internal readonly flag; it's simpler to just call object.__setattr__ to init the read-only fields, so the custom __setattr__ can be simplified. (Should check also other datatypes that use this pattern, maybe something in unpythonic.collections?)

Also, must intercept also __delattr__ to properly emulate immutability. Not sure if we currently do this (probably not - hence the bug label, we need to check).

@Technologicat Technologicat added the enhancement New feature or request label Sep 25, 2019
@Technologicat Technologicat added this to the 0.15 milestone Sep 25, 2019
@Technologicat Technologicat added the bug Something isn't working label Sep 25, 2019
@Technologicat Technologicat modified the milestones: 0.15, 0.15.x Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant