This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Reader option to permit brackets as parentheses


Craig Brozefsky <craig@red-bean.com> writes:

> If you were to move to a whitespace structured language, imagine the
> difficulties of writing real macros!  With the parenthesis based
> s-expression, where a program/function is a list, you can write macros
> programmatically, by creating lists.
> 
> If you have to create something like whitespace delimited blocks, then
> your program for creating new forms will have to be much more complex,
> and are not as easy to produce.  Even if you just mapped tabs onto
> parens, you would have to always be aware of your depth.

In Haskell (another language where whitespace is lexically
significant), any expression can also be written in a form where
whitespace is not lexically significant.  There is a simple lexical
preprocessing phase that looks at the indentation of successive lines
and adds open and close braces and semicolons; if you use explicit
open and close braces, then the "layout rule" is not active.

I would strongly suggest that any whitespace structured Scheme follow
the same path: there should be a simple lexical preprocessor that adds
open and close parens, and you can always use the open and close
parens yourself.  As in current Lisp-family languages, macros would
act on and return s-expressions, not ASCII strings; so I don't see why
they would be any more difficult to write than in current Scheme.

I must admit that I'm having a hard time imagining what a whitespace
structured Scheme would look like; I doubt if I'd use it (even though
I really like the Haskell layout rule).

Carl Witty
cwitty@newtonlabs.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]