> On Jun 13, 2017, at 3:23 PM, Jens Axel Søgaard <jensa...@soegaard.net> wrote:
> 
> The problem arises when I need to break the line before [y ys]. DrRacket
> insists on indentation [y ys] to be below [x xs] rather han below [v vs].
> 
> That is, I get:
> 
>   (for ([v vs] [x xs] 
>                [y ys]) 
>       body)
> 
> but I want
> 
>   (for ([v vs] [x xs] 
>         [y ys]) 
>       body)

This re-raises the question of how we should express indentation rules in a 
better way. Georges Duperon came up with some good ideas in this thread:

https://groups.google.com/d/msg/racket-users/IL8vygdUHu8/otYUtEbtBAAJ 
<https://groups.google.com/d/msg/racket-users/IL8vygdUHu8/otYUtEbtBAAJ>

How do we take these ideas and extend them so that we can specify indentation 
rules for sub-pieces of sub-pieces of different forms?

I'm imagining the existing DrRacket indentation rules would be expressed as:

normal: (=0   =1   +0)
begin-like: (=0   =2   +0)
define-like: (=0   =2   =2   +0)
lambda-like-currently: (=0   =4   =2   +0)
for/fold-like-currently: (=0   =4   +0   =2   +0)

But your for rule would be more complicated, specifying indentation within 
subexpressions:

for-like: (=0   =4(=1(=1))   =2   +0)
for/fold-like: (=0   =4(=1(=1))   +0(=1(=1))   =2   +0)
lambda-like: (=0   =4(=1)   =2   +0)
struct-like: (=0   =2   =2(=1)   =2   +0)

(The struct rule above doesn't take sub-structs into account)

Forms like match and cond would be weird cases because ideally their 
indentation would be able to depend on whether one of the things after the test 
is special, like `=>` for cond or `#:when` for match. This might be too 
complicated though. Without trying to fit in special cases like that, they 
would be:

cond-like: (=0   =2(=1)  +0(=1))
match-like: (=0   =4   =2(=1)   +0(=1))
match*-like: (=0   =4(=1)   =2(=1(=1)  =1)   +0(=1(=1)  =1))

Does this language make sense as a specification for indentation rules?

Alex Knauth

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to