First of all, I want to make it clear that I'm not completely opposed to
using "." as an option for indentation.
Having said that, I think your examples are flawed; the logic of your
example is difficult to follow. I also don't think you're using COND
correctly--but that could just be me, because I'm an inexperienced Lisper,
but I'm coming from a Common Lisp background.
I've tried to re-write this as a classical s-expr, and I got this:
(cond
((expr1? f) (let ((var (list-of x
({t in '(1 2 3 4)}
(pred? t)
{x in range-of(0 t)})))
(var2 (kitty ('meow) ('meow))))
(execute
((foo var))
((quux var2)))))
((expr2? f) (progn (kitty
('niaw)
(expand-upon('niaw)))
(woorf f)))
(#t (error "bobcat: NYAWR")))
Then I've re-written this as a sweet-expression:
cond
exprl?(f) \\ let
\\ var list-of(x
({t in '(1 2 3 4)}
pred?(t)
{x in range-of(0 t)}))
var2
kitty
'meow
'meow
exprl2?(f) \\ progn
kitty
'niaw
expand-upon('niaw)
woorf(f)
#t \\ error("bobcat: NYAWR")
I think my implementation is also flawed--again, the problem centers around
COND--because I don't think my re-write correctly wraps the conditions with
the correct results. From this, I have the following observations and
questions:
-- How do we pair up two lists on a single line? If I understand
correctly, the '\\' SPLICE context creates two lists, where we would expect
one list. Does it also wrap up the two lists in a single parent list?
-- What happens when we have a sublist indent after a line with a '\\'
SPLICE? Does it become a sublist of the last list of the SPLICE?
-- I think using a '\\' is better than a single '\' is better, because it
is more visually appealing.
-- To get to the bottom of the issue of whether it is valuable to admit "."
as whitespace, I think we need real code examples. While coming up with
fake examples can be informative (I hadn't thought about the implications
of "\\" splice and following sublists...), ultimately, they are also
dangerous, because they don't represent actual code, and how it might be
naturally written.
-- I'm still on the fence with this, although one compelling argument *for*
the convention involves my experience with Python: when I'm desperate
enough to replace all the " " indents with "--|" or ". " (or something
just as heavy), it eliminates the possibility of cutting snippets of Python
and pasting it into an REPL. Of course, Python, with its tradition of
including ellipses before every line in its REPL, makes it more difficult
to cutting snippets from the REPL and pasting it into an editor--and
impossible to paste *back* into the REPL.
-- I think this example also shows that using two spaces for indentation,
when whitespace is significant, can also be difficult to read. In using
Python, I tent to prefer three spaces, but when the editor defaults to
four, I don't fight it (and it's probably better too); and there are
certainly times where a LOT of indentation clears things up really quickly!
On Thu, Jul 19, 2012 at 3:03 PM, Alan Manuel Gloria <almkg...@gmail.com>wrote:
> On Fri, Jul 20, 2012 at 12:03 AM, Alpheus Madsen
> <alpheus.mad...@gmail.com> wrote:
> >> Certainly using "--|" is very heavy, but the point of using . is that it
> >> is much lighter visually.
> >
> >
> > Just for clarification: I've never used "--|" in a language as
> "official"
> > syntax; I've used it (and variations of it) in Python and PHP when I
> really
> > needed to see the structure.
> >
> > Come to think of it, there is Emacs code out there that can color-code
> the
> > levels; I have never tried using it, though.
>
> My argument still stands, though: sometimes the tool isn't there.
> There's something to stuff that just works with plain text.
>
> "." is the lightest syntax that is still typeable on the standard
> keyboard: the period is the character with the smallest canonical
> graphical representation that is typeable on a majority (all?) of
> keyboards.
>
> So: I'd like to know, if you think:
>
> cond
> expr1?(f)
> let
> \\
> var
> list-of x
> t in '(1 2 3 4)
> pred?(t)
> x in range-of(0 t)
> var2
> kitty
> 'meow
> 'meow
> execute
> foo(var)
> quux(var2)
> expr2?(f)
> kitty
> 'niaw
> expand-upon('niaw)
> woorf(f)
> #t
> error "bobcat: NYAWR"
>
> is superior to:
>
> cond
> expr1?(f)
> . let
> . \\
> . . var
> . . list-of x
> . . t in '(1 2 3 4)
> . . pred?(t)
> . . x in range-of(0 t)
> . . var2
> . . kitty
> . . 'meow
> . . 'meow
> . execute
> . foo(var)
> . quux(var2)
> expr2?(f)
> . kitty
> . 'niaw
> . expand-upon('niaw)
> . woorf(f)
> #t
> . error "bobcat: NYAWR"
>
> ?
>
> Personally, now that I've adjusted to the "." as indentation, it seems
> to me that the "." vertical lines there are superior. In fact, typing
> in the latter is much easier than the former - I don't have to count
> indents, I just look at the periods as a guide line/construction line
> so that I align properly. If we can make sweet-expressions much
> easier to type in at a small cost to readability - and I think the
> latter case as above isn't so bad readably, and is superior - than
> perhaps we should consider putting it in.
>
> Sincerely,
> AmkG
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss