[racket] match plus #:super structs => no nice fit?
On Tue, Sep 21, 2010 at 5:45 PM, Ryan Culpepper <ryanc at ccs.neu.edu> wrote:
> On 09/21/2010 03:36 PM, Sam Tobin-Hochstadt wrote:
>>
>> On Tue, Sep 21, 2010 at 5:31 PM, John Clements
>> <clements at brinckerhoff.org> wrote:
>>>
>>> It looks to me like match doesn't work nicely with #:super structs. For
>>> instance, this program:
>>
>> [snip]
>>
>>> It's easy to work around this, but it would be nice if it worked. Am I
>>> missing something obvious?
>>
>> I don't know if it's obvious, but `match' is relying on static
>> information about the fields of `b', but `struct:a' is only known
>> dynamically. So at expansion time, `match' has no idea how many other
>> fields there might be other than the ones explicitly declared in `b'.
>
> I thought match raised an error if the static info wasn't completely known.
Currently, it just treats those structs as empty, but it would be easy
to change. The code, if you want to see, is line 89 of
racket/match/parse-helper.rkt.
--
sam th
samth at ccs.neu.edu