[plt-scheme] (v4) wildcard not allowed in expression

From: Jos Koot (jos.koot at telefonica.net)
Date: Mon Jun 23 22:53:14 EDT 2008

I am not aware to have contributed anything to http://docs.plt-scheme.org/reference/stx-patterns.html#(form._((lib._scheme/private/stxcase-scheme..ss)._......))  :)
Wildcards in a pattern are useful though, I think. It is as though saying "i dont care what it is and dont want to know what it is". But if you realy don't care, there is no issue by binding the wild-card. It is possible to do without the wild-card. There are two things that make the wild-card different:
1 : it may appear more than once in a pattern. Other symbols in a pattern do not have this privilege.
2 : The wild-card is completely ignored.
Wild cards are a method in pattern matching (thats what syntax-rules and syntax-case are about)
I must admit that I use the _ only as in (syntax-case stx () ((_ whatever ...) template))
I admit that in most cases a macro writer is interested in what the user did write in the macro call.
I cannot answer the "why". But the "how" is clear to you now, I am sure.
I have done many courses on how to use a computer (dating from decades from now) Students often asked me "why do I have this to do in this way?" Answer: because that is the way that makes it work. On the PLT list or bug-report form you have the opportunity to express how you want to work things (which a few decades ago was unthinkable) My experience is that the PLT team is susceptible for new ideas. But in the present case I think that the wild-card is a commonly accepted and wanted feature that is not going to be altered.

May be you are experiencing, just as I do, that improvements on the language require efforts of the user on adapting his/her code. That's annoying of course, but without a posotive attitude of the users, software providers cannot implement improvements.

MHO, Jos

  ----- Original Message ----- 
  From: YC 
  To: Jos Koot 
  Cc: pltscheme 
  Sent: Tuesday, June 24, 2008 4:04 AM
  Subject: Re: [plt-scheme] (v4) wildcard not allowed in expression

  Thanks Jos for the explanation.

  I do not grok how prohibiting a wildcard appearing in a template makes it useful.  Is there a place that explains the rationale behind the change?  I tried searching the docs but are not successful so far except for a short description of what you've said in http://docs.plt-scheme.org/reference/stx-patterns.html#(form._((lib._scheme/private/stxcase-scheme..ss)._......))


  On Mon, Jun 23, 2008 at 6:47 PM, Jos Koot <jos.koot at telefonica.net> wrote:

    Correct. _ has become a wild-card that is bound to a syntax that does not want to be called. You can no longer use _ like other symbols. Hence the wild card may appear in a pattern, but you should not use it in a template. That is in R6RS or PLT 4. In 371 _ was just a symbol like any other one. Why in Pretty Big it still works as an ordinary symbol in old fashion, I don't know.
    If you want a symbol that is associated with the name of the syntax use anything else than a wild-card. The wild-card is not bound to a pattern element (except may be in Pretty Big, I don't know)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080624/31c15124/attachment.html>

Posted on the users mailing list.