Skip to content

How to enforce types for a struct/class? #1272

Answered by vyzo
bistace asked this question in Q&A
Discussion options

You must be logged in to vote

You can already attach contracts/types to slots, it is just not documented yet.

So you can write (defclass Foo ((a : some-type) (b : some-other-type))) and so on, with any contract declaration.

The generated constructor and mutators will then enforce the type.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by bistace
Comment options

You must be logged in to vote
7 replies
@bistace
Comment options

@vyzo
Comment options

vyzo Oct 1, 2024
Maintainer

@vyzo
Comment options

vyzo Oct 1, 2024
Maintainer

@vyzo
Comment options

vyzo Oct 1, 2024
Maintainer

@bistace
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants