Re: Comment on SRFI-110 and Comparison to Genyris xyzzy
David A. Wheeler 23 May 2013 13:39 UTC
Bill Birch <xxxxxx@gmail.com> wrote:
> Re: http://srfi.schemers.org/srfi-110/srfi-110.html#genyris
Thanks so much for posting!
> I have made some syntactic decisions which I regard as restricting
> programmers to write in a better style. For example not allowing lists to
> wrap encourages more smaller functions. That's OK for source code, however
> when loading data files one should not restrict the structure. One
> difficulty with a syntax that defaults to lists is that something special
> needs to be done for atoms.
>
> Example (a b c (d e f) xx) is problematic since xx is subordinate but is
> not a list. So in Genyris I was forced to add a leading 'continuation'
> character ~. Which gives me:
> > quote
> : a b c
> : d e f
> : ~xx
> :
> (a b c (d e f) xx) # PairSource
>
> There is another (obvious) way to wrap lists in Genyris just place
> a = at the end of the line. example:
> > list 1 2 3 4 5 =
> : 6 7 8
> :
> (1 2 3 4 5 6 7 8) # Pair
>
> In practice I don't often use line continuation in code.
Great points. I plan to cut-and-paste the above text
(with credit) into the SRFI-110. Although I've made different decisions
in sweet-expressions, I think it's helpful to see the contrast.
> One thing to remember is that indentation may force you to re-arrange
> functions to suit the constraints of indentation. For example I had a
> function 'tag' which took two arguments, an expression and a class. e.g.
> tag (+ 2 3) Inches
>
> But when the expression begins to get complex it made more sense to
> re-order the function to give tag <class> <expression> simply so the
> expression could grow on the subordinate indents. example:
...
> So if you use indented syntax expect the language itself to change!
Fair point. If it's just a matter of reordering arguments for
convenience, macros should be able to handle that nicely, but I
think that's a plausible general principle. Lisp syntax has (in my opinion)
ossified. Indentation adds a new dimension to syntax, and thus
creates new possibilities for ease-of-reading.
> Cheers,
Thanks! And thanks very much for your comments.
--- David A. Wheeler