guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fmatch


From: stefan
Subject: Re: fmatch
Date: Sun, 20 Jun 2010 21:58:59 +0200
User-agent: KMail/1.12.4 (Linux/2.6.31.12-0.2-desktop; KDE/4.3.5; x86_64; ; )

On Wednesday 16 June 2010 11:31:14 pm Ludovic Courtès wrote:
> Hi Stefan!
> 
> Sorry for the late late reply.
> 
> stefan <address@hidden> writes:
> > Anyway git diff --cached  gives the attached patch file.
> >
> > Also I made the code less hacky by using define-syntax in stead
> > of a defmacro and macroexpand for the defin-syntax sugar (oh hacker).
> > It was a litle more work then I expected.
> 
> OK.  I just applied the patch and looked at ice-9/match.scm.
> 
> To start with, I committed the unmodified pattern matcher by Shinn, a
> simple (ice-9 match) that just includes it, and a small set of tests.
> 
> The next step will be to integrate your work in match.upstream.scm (sic)
> and discuss it with Shinn.
> 
> Thanks,
> Ludo'.

Cool!

I think that the match-define logic is something that is missing in the 
Shinn version although I don't know how much this construct is used.

For the $ destruction I would be very careful, as you know from the irc 
discussion. So for all to be able to participate here is a short 
description of the problem with $.

Basically $ is using the order of the records like ($ person? Rec1 Rec2 , ... 
Recn)
and is nice to do quick hacks and get dense informative matchers. On the 
other hand if the record specification changes, like the order of the 
records or meanings etc havoc can enter. So destructuring on order would 
probably, in the end, yield a buggy code base. And I suspect that this issue 
makes the $ construct less liked and probably will not be accepted upstreams.

On the other hand we have the record-case construct that is somewhat dense in 
information but is not hygienic. That would leave us with constructs like

(and (= person-height pat1)
     (= person-weight pat2)
     ...)

We can streamline it a little but the end win is marginal compared to the 
size of usual accessor names.

I would have liked something like
($ person (height pat1) (weight pat2))

But again this is not hygienic!

What do you think?

Regards
Stefan











reply via email to

[Prev in Thread] Current Thread [Next in Thread]