On Sun, Nov 10, 2013 at 12:36:13PM -0500, Matthias Felleisen wrote: > > Have you considered classes instead of structs? -- Matthias
Matthias, Thanks for the response. Classes did cross my mind, but in the particular use case I'm working on now, they feel a little too heavy. Perhaps that is a relative lack of familiarity on my part... (As a side question, are there any particular collections for use outside gui apps which utilize classes in a way you find exemplary?) Also, I want to utilize #:property prop:evt. In fact I had wanted to rely on this alone and not require a new struct type, but then I realized I need to attach some private data to each instance. There were 3 aspects of my original post in this thread: - enumerate the different struct-based solutions I had considered and why they were slightly less than ideal - determine whether I was missing an alternative solution within structs - suggest a potentially useful new feature Based on your response and the lack of other responses, I'm assuming there is no other solution built-in to structs. I could write a macro that allows users of my module to define their subtypes of my type and get a constructor that initializes the private value without exposing it. Looking through the racket repository, I don't see any struct types that use both #:auto and #:guard. Maybe no one else has ever hit this. I was hoping someone would comment on the new feature idea (something like #:guard that can provide values for #:auto fields.) Maybe its a bad idea on its face, or maybe it would have been a good idea only if it had been suggested when structs were originally introduced. I'm not asking anyone to implement such a feature. If there was consensus that it could be a good feature and a way to make it not break existing code, I'd be willing to try to implement it. David ____________________ Racket Users list: http://lists.racket-lang.org/users