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

Re: [r6rs-discuss] [scheme-reports] Scheme pattern matching & R*RS

On 22 January 2011 15:56, Andre van Tonder <andre@x> wrote:
> On Sat, 22 Jan 2011, David Rush wrote:
>> On 22 January 2011 00:09, Andre van Tonder <andre@x> wrote:
>>>  It seems to go against the founding moral principles
>>> of Scheme.
>> What? It's a single unifying mechanism for type-dispatch. It allows
>> unification of call/return without resorting to CALL-WITH-VALUES.  If
>> there's any language idea out in the wild that Scheme *hasn't" got
>> already that fits the Clinger criterion more than pattern matching,
> At the risk of sounding like a theologist, I suppose we are both referring
> to
...(quoting the prime Clingerism)...
> and, much like theologists, deriving opposite meanings from it.

what a delightful thought :) But please remember, I *am* somewhat
ambivalent about pattern-matching in Scheme. The drift towards
overloading LAMBDA and DEFINE in WG2's module is my primary motivation
for bringing this up. My only argument is that if we, who are involved
in the SchemeNG effort, are going to do this, it should be a concerted
effort that is brought in at the WG1 level.

Are the pattern matching primitives being considered for WG2 even
expressible in R[456]RS?

> I consider pattern matching a pretty huge feature that would be justifiable
> in the core only if it added orthogonal expressivity, which it does not.

it is certainly less verbose for similar semantics (modulo
s-expression notation). So if you consider expressivity to be reckoned
in units of semantics per lexeme, it might very well be more
expressive :) OTOH, there are patterns of type dispatch which are
not-expressible through pattern-matching, so maybe it is *less*
expressive. Given that we aren;t really into programming on Turing
machines, I guess there's not really an absolute measure.

> I used to be all gung ho about pattern matching when I first encountered
> Scheme, until I started reading some elegant big programs in Scheme and got
> used to the more Schemely idiom of doing the same kind of thing, which
> turned out to be as readable and often a better apporoach to abstraction.
> What I mean is that pattern matching often does not encourage good
> abstraction. Which of the following is the better abstracted program
> ML or Haskell programs are chock full of the former, which looks cool
> exactly until they want to add an extra field to a data type and all of a
> sudden realize that they have to change their whole program and all programs
> that import the same types.

Yes. I've been bitten by that bug. It is much easier to avoid using
the abstraction mechanisms present in ML than it is with Haskell's
abstractions (at least given my current level of Haskell-fu). I am
actually convinced that it derives from limitations on the type
inference used in those languages, and not a necessary feature of
pattern matching. Scheme, of course is not so constrained. But I'm
going to stop here, because going further would be to wander far away
from Scheme issues ;)

GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt

r6rs-discuss mailing list