First, a quick note: the Haskell "offside" rule works because it triggers on 
specific keywords (e.g., "do", "let", "of", and "where").  I think it's 
important for a *Lisp* that the semantics be *general* and not tied to a 
semantic, as I've explained further elsewhere, so I don't think that approach 
is a good one as-is for a Lisp.

Beni Cherniavsky-Paskin had an interesting post about a completely different 
approach, but as both he and Alan Manuel Gloria have noted, that alternative 
has some serious problems. E.G.:

Alan Manuel Gloria:
> > Here's an even bigger deal-breaker: it makes parent structures harder
> > to modify, because if the length of the parent is changed (for example
> > inserting an argument you forgot in the first pass of writing the
> > code, or modifying an existing function to accept a new argument, or
> > adding some logging code, or whatever) then you have to re-indent all
> > the children.
> > ... In Common Lisp, "|" is used to denote symbols with "special
> > syntax", i.e. (symbol "foo bar") => |foo bar|.
> > ...  Supporting "| defun foo | a b" requires knowing how wide
> > characters are (CJK width problem), ...

I separately noted that this approach won't work with varying-width fonts at 
all (and many email systems display with them!).

Beni Cherniavsky-Paskin later posted:

> I actually don't like it much :-)
> It was interesting to me as "simplest thing that could possibly work", but:
> - I actually do like the auto-listification of "foo bar".
>    Having to prepend each line with | would annoy me...
> I still wish for a way to make a bullet-style call or list where the first
> line is handled like the others.

Though not exactly what you asked for, sweet-expressions currently have 
something that might make you happier.

Fundamentally "\\" as the first marker just means "nothing, but use this 
position as the indent level", so you can already do this in sweet-expressions:
 \\ a
 \\ b
 \\ c
(f a b c)

You can even do that at the top level:
\\ a
\\ b
\\ c

This works in the current prototype implementation ("unsweeten") and the new 
BNF (implemented with ANTLR).

We envisioned using this for *distinguishing* elements that were at the same 
list level but were in fact different, such as Arc's if statement:
  \\ action1
  \\ action2

But it could be used this other way instead if you wanted to.

--- David A. Wheeler

Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
Readable-discuss mailing list

Reply via email to