-
-
Notifications
You must be signed in to change notification settings - Fork 647
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
Support methods for runtime struct creation #2142
Comments
The problem with what you suggest is that You'll also note that this addresses only the value half of the syntax property. An identifier like There's some discussion at #1647 about providing a public interface for third-party libraries to do this sort of thing, but there wasn't consensus that it should be done, and I don't know that there's been any movement on it. More broadly, Even in that rare case, I believe you could use |
@LiberalArtist Thanks for the very detailed explanation of the issue and the reference to #1647. I will go ahead and close this, which in any case is a duplicate. I noticed to my surprise that |
When creating new struct types at runtime using
make-struct-type
at the moment it doesn't seem to be possible to define generic methods on it (half-confirmed by @samth on Slack).This is a serious shortcoming on anyone relying on generic methods to design interfaces. Can we get this supported?
I have noticed that in:
racket/racket/collects/racket/private/define-struct.rkt
Line 287 in 9cd3798
#:methods
seem be converted into#:property
using some syntax likegeneric-property
which is not exported. Can we a newmethods
argument inmake-struct-type
that uses this internally to transform the methods into properties?The text was updated successfully, but these errors were encountered: