[plt-scheme] associating data with structure types
In that case we should seriously consider offering a second
define-struct*** construct along the lines of Chez, where you can add
in "default" fields and things like that. Of course, you can define
this via units/modules in MzScheme as it exists, but I have run into
this thing so often now that it almost seems something we should have
in the language.
-- Matthias
On Mar 19, 2004, at 3:02 PM, Robby Findler wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> You can add properties to structure types. That sounds like what you
> need. You cannot use define-struct, tho. You have to use the
> make-struct-type interface.
>
> Robby
>
> At Fri, 19 Mar 2004 15:00:53 -0500, "Neil W. Van Dyke" wrote:
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>> I want to associate at least one piece of data with each subtype of a
>> particular structure type. In this particular case, the data is
>> constant, and is known at the time the structure subtype is defined.
>>
>> One way to do this would be with a hashtable keyed on the structure
>> type
>> object. But I'd prefer to encapsulate the data within the structure
>> type object itself, rather than maintain a homomorphic structure.
>>
>> Is there a "user data" field in the structure type info (alongside the
>> constructor, predicate, etc. info) that could be used for this? I
>> couldn't find reference to such a thing in the documentation.
>>
>> Alternatively, for my current problem, an older MzScheme wishlist item
>> -- user-definable print and write methods for structure types -- would
>> work.
>>
>> --
>>
>> http://www.neilvandyke.org/