[plt-scheme] conventional syntax (was: Scheme contradictions)

From: Eli Barzilay (eli at barzilay.org)
Date: Sun May 7 04:07:42 EDT 2006

[reordering]

On May  7, Matthew Flatt wrote:
> To be clear, I am *not*
> 
>  * suggesting that you try to use #honu right now;
> 
>  * planning to post more about the design in the near future; 
> 
>  * receptive to advice against the experiment;
> 
>  * soliciting design opinions; or
> 
>  * planning on reduced support for Scheme-style syntax --- though, if
>    all goes well, I will eventually switch my primary mode of
>    expression.

Given this, my two comments below are parenthetical.


> P.S. - If you're curious how #honu works, try inserting a ' before
> #honu. See also the "Honu" chapter in the MzScheme manual.

It would be nice if the #honu reader would be implemented as a layer
on top of another reader that translates:

  #{
    ...your honu code...
  #}

to something like:

  (#%seq function len (#%parens lst) (#%braces if ...) var myList = ...)

Using this, the #honu reader is easy to implement, but it will also be
possible to play around with other infix and infix-ish syntaxes
independent of different semantics (like an infix syntax for Scheme
only -- your code sample without using `return').


> You can import into #honu from any Scheme library, though you may have
> to use the #sx escape to write a Scheme name, perhaps in the process of
> switching to a "conventional" identifier:
> 
>  #honu
>  require rename(lib("mred.ss", "mred"),
>                 getFontFromUser,
>                 #sx get-font-from-user);
>  getFontFromUser();
> 
> Obviously, a long-term solution involves either renaming Scheme imports
> automatically or writing a translation for common libraries.

One possible solution that would be useful in general is to find some
way for specification of renamings that can do more than just
prefixing.  Maybe something that is based on `regexp-replace', or some
way of using Scheme code to do the renaming...  (So eventually you can
get`foo-bar?' to be renamed automatically to `isFooBar' or
`is_foo_bar'.)

Another option that is more useful for some generic #{...#} syntax is
if it can be parameterized somehow by some identifier-level
translator.  Actually, given that my part as (a user of such a reader)
would be to implement a `#%seq' macro, then I can make the macro do
its own translation so a simple library function that will crawl down
a syntax and apply an identifier translator is enough.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.