[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First impressions of the specification



On Wed, Mar 27, 2013 at 9:00 PM, Mark H Weaver <mhw@xxxxxxxxxx> wrote:
>>> * I have doubts whether the addition of '!' as an indentation character
>>>   is worth the added complexity in the spec (which is far more complex
>>>   than I'd prefer, and I'm sure I'm not alone in feeling that way).
>>>   Python seems to do fine without such a character.  So do Makefiles.
>>>   If it's truly needed, then it presents authors with a dilemma about
>>>   whether or not to put them in all the code that they write.
>>
>> ! is surprisingly useful.  Here's an example which is readable, but
>> difficult to modify if you need to add an else clause:
>>
>> define (foo x)
>>   define something $ cond
>>                        (pred1? x) $ begin
>>                                       something that is
>>                                       very long
>>                                       spanning several lines
>>                                       and might
>>                                         end up
>>                                           with severe
>>                                             changes in indentation
>>                                       like this
>>                                       and so on
>>                                         so forth
>>                                         whatsover ...
>>                        (pred2? x) $ begin
>>                                       another long clause
>>                                       involving several
>>                                         more lines
>>                                       and which
>>                                         also ends
>>                                           in
>>                                             (severe)
>>                                           changes
>>                                             in indentation
>>                                               at the end
>>   quux something
>
> Hmm.  I see what you mean, but I'd expect python to have the same
> problem, and yet they seem to do fine without this.
>
> For that matter, a similar example using traditional S-expressions could
> demonstrate the difficulty in adding a new clause and getting things
> lined up properly.  Of course, as you say:
>
>> In s-expressions, it's safe to lose a space or two when you insert a
>> clause at the end of the cond - the parens (should) guide the parser
>> to the correct insertion.
>
> and that's true in theory, but in practice we almost never see
> incorrectly indented S-expr code, and that's because almost everyone who
> writes Lisp gets a lot of help from modern editors.
>
> And that leads to my next question: has anyone written a nice emacs mode
> to help edit sweet expressions?  I think that such a mode will be
> crucial for adoption.  I doubt that many Lisp hackers will be interested
> in trying to get things lined up by hand.  We've had better tools for
> decades, and have grown accustomed to those conveniences.  Almost none
> of us want to go back to the stone age, no matter how nice it looks.

None so far, sadly.  Both dwheeler and I are vim users, me much more
so than David.  I have no real idea how modes work in emacs at all,
and vim-isms are quite ingrained in my fingers by now (hjkl when I
meant to use arrow keys to scroll, for example).  ! is a boon to me,
particularly with vim's Ctrl-V block selector and "r" commands.

dwheeler occassionally uses emacs I think (?) so he might be more
capable of doing this.

Sincerely,
AmkG