[plt-dev] "poll": scribble syntax & indentation

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Mar 6 15:02:07 EST 2009

On Mar  6, Robby Findler wrote:
> Did you consider having the scribble reader be more sophisticated
> with the strings it generates? That is, if a string comes from {} in
> Scribble (as opposed to "something" in a s-expression position --
> those don't get this special treatment), then it only puts enough
> spaces in to go from the { to the rest of the lines? (Well, probably
> it would have to start at the leftmost position in the {}, but let
> me illustrate).
> Eg:
> @f{a
>    b
>    c}
> would be (f "a\nb\nc") instead of (f "a\n   b\n   c").
> [...]

It already does that, for example, try these two:

  #lang at-exp scheme/base

It's slightly different than what you suggest in that it keeps
separate "\n" strings so it's easy for functions that want to do some
line-based processing.  (And these "\n" are parsed as string syntax
objects with a property that contains the original string exactly, so
you can still get a "real verbatim" effect.)

I'm happy to have made it this way, because including the text with
the spaces would make things impossible to use sanely.  (Same reason
as above: the indentation would come from the place where a function
happens to be defined, so spaces would be pretty much random.)

On Mar  6, Robby Findler wrote:
> Hm. I don't know who messed up the indentation below, but the first
> example should look like the output of this expression:
> (display "@f{a\n   b\n   c}")

(Looks like your mail client messed up showing it to you, it was
perfectly fine in the email you sent...)

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

Posted on the dev mailing list.