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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Mar 7 14:56:55 EST 2009

Oh, I see.

Perhaps the right thing is to treat nested list structure as starting
a new indentation block, so that the "something1" is indented relative
to the beginning of the list that it is in, resulting in this output:

function foo() {
   if (1 < 2)
     something1
   else
     something2
   fi
   return
}

In other words, you'd have a 'flatten' function that would be called
(in this case) by (something like) the scribble/text module-begin that
instead of being just 'apply string-append' it would also prefix each
element of a sublist by an indentation amount. You'd provide this
function for uses in other contexts (like in an at-exp language) and
people would just have to call it there, instead of having it work
automatically.

This would generalize to 'with prefix' if you wanted to, but I think
this example from your original message:

 function foo() {
   var lst = [@list{item1,
                    item2}]
   // @list{comment1
            comment2}
   return
 }

would turn into this:

 function foo() {
   var lst = item1,
   var lst = item2
   // comment1
   // comment2
   return
 }

(ie, it would have an extra 'var lst =' for the first list).

Robby


Posted on the dev mailing list.