Re: Incompatibility with pattern matching
Marcin 'Qrczak' Kowalczyk 20 Sep 2005 12:01 UTC
Andre van Tonder <xxxxxx@now.het.brown.edu> writes:
> It seems that the constructor paradigm chosen in the draft does not
> easily accommodate future extensions for pattern matching. The
> problem is that a constructor can be many to one. E.g., in
>
> (define-type foo (x y)
> (fields a immutable (+ x y)))
>
> we cannot automatically generate a pattern that can be used (like in MzScheme):
>
> (match (make-foo 1 2)
> ((make-foo x y) .....))
Automatic generation of such patterns could be limited to records with
particular properties, e.g. when all parameters are used to initialize
some fields.
In other cases you would define the semantics of pattern matching
yourself if desirable.
--
__("< Marcin Kowalczyk
\__/ xxxxxx@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/