On Mar 13, 2012, at 8:37 AM, Matthias Felleisen wrote:

> 
> 1. I think the 'unnecessary' gives you some wiggle room here. 
> 
> 2. I occasionally leave a 'necessary' blank line in code but prefix it with 
> ";;" to signal that I left it blank intentionally. 
> 
> 3. I would write the code below, and I would consider it fine w/o blank 
> lines, though yes, I'd add purpose statements to the auxiliaries. 

Can I therefore suggest the following update to the style guide? :


5.8 Spaces

Don't pollute your code with spaces at the end of lines.

If you find that your code requires blank lines in order to aid readability, 
consider refactoring your program to introduce auxiliary functions and shorten 
long blocks of code.


>> "5.8 Spaces
>> 
>> Don’t pollute your code with spaces at the end of lines and extraneous blank 
>> lines."
> 
> 
> ;; flag-teachpack-requires : syntax nat -> syntax
> ;; apply the 'stepper-skip-completely hint to all
> ;; teachpack requires.
> ;; -- it would be great to do this directly when the 
> ;; requires are added, but they're not yet syntax there,
> ;; and this seems like the easiest way to fix it.
> (define (flag-teachpack-requires stx num-teachpacks)
>  (syntax-case stx ()
>    [(mod name lang bodies-stx ...)
>     (begin
>       (define bodies (syntax->list #'(bodies-stx ...)))
>       (*check-teachpacks bodies num-teachpacks)
>       (define-values (teachpack-requires remaining-bodies) (split-at bodies 
> num-requires))
>       (*check-requires require-form? teachpack-requires)
>       ;; -- IN -- 
>       #'(mod name lang
>              #,@(flagged-requires stx teachpack-requires)
>              #,@remaining-bodies))]))
> 
> (define (*check-teachpacks bodies num-teachpacks)
>  (when (< (length bodies) num-teachpacks)
>    (error 'flag-teachpack-requires
>           "internal error: expected bodies to include teachpack requires, 
> got: ~e"
>           bodies)))
> 
> (define (*check-requires require-form? teachpack-requires)
>  (unless (andmap require-form? teachpack-requires)
>    (error 'flag-teachpack-requires
>           "internal error: expected these to be teachpack requires: ~e"
>           teachpack-requires)))
> 
> (define (flagged-requires stx teachpack-requires)
>  (for/list ([tp-rq (in-list teachpack-requires)])
>    (stepper-syntax-property stx 'stepper-ignore-completely #t)))
> 
> 
> 
> 
> On Mar 13, 2012, at 2:16 AM, John Clements wrote:
> 
>> The style guide has this to say about blank lines:
>> 
>> "5.8 Spaces
>> 
>> Don’t pollute your code with spaces at the end of lines and extraneous blank 
>> lines."
>> 
>> This comes out pretty strongly against "extraneous" blank lines. In writing 
>> the code below, though, it seems to me that the blank lines aid readability, 
>> and that the version without them (below) just looks scary. Opinions?
>> 
>> (To be fair, you really have to view the following in DrR, not in your 
>> e-mail program.)
>> 
>> First, with extraneous blank lines:
>> 
>> ;; flag-teachpack-requires : syntax nat -> syntax
>> ;; apply the 'stepper-skip-completely hint to all
>> ;; teachpack requires.
>> ;; -- it would be great to do this directly when the 
>> ;; requires are added, but they're not yet syntax there,
>> ;; and this seems like the easiest way to fix it.
>> (define (flag-teachpack-requires stx num-teachpacks)
>> (syntax-case stx ()
>>   [(mod name lang bodies-stx ...)
>>    (begin
>> 
>>      (define bodies (syntax->list #'(bodies-stx ...)))
>> 
>>      (when (< (length bodies) num-teachpacks)
>>        (error 'flag-teachpack-requires
>>               "internal error: expected bodies to include teachpack 
>> requires, got: ~e"
>>               bodies))
>> 
>>      ;; these should be the teachpack requires:
>>      (define-values (teachpack-requires remaining-bodies)
>>        (split-at bodies num-requires))
>> 
>>      (unless (andmap require-form? teachpack-requires)
>>        (error 'flag-teachpack-requires
>>               "internal error: expected these to be teachpack requires: ~e"
>>               teachpack-requires))
>> 
>>      (define flagged-teachpack-requires
>>        (for/list ([tp-rq (in-list teachpack-requires)])
>>          (stepper-syntax-property stx 'stepper-ignore-completely #t)))
>> 
>>      #'(mod name lang
>>             #,@flagged-teachpack-requires
>>             #,@remaining-bodies))]))
>> 
>> 
>> Then, without them:
>> 
>> ;; flag-teachpack-requires : syntax nat -> syntax
>> ;; apply the 'stepper-skip-completely hint to all
>> ;; teachpack requires.
>> ;; -- it would be great to do this directly when the 
>> ;; requires are added, but they're not yet syntax there,
>> ;; and this seems like the easiest way to fix it.
>> (define (flag-teachpack-requires stx num-teachpacks)
>> (syntax-case stx ()
>>   [(mod name lang bodies-stx ...)
>>    (begin       
>>      (define bodies (syntax->list #'(bodies-stx ...)))
>>      (when (< (length bodies) num-teachpacks)
>>        (error 'flag-teachpack-requires
>>               "internal error: expected bodies to include teachpack 
>> requires, got: ~e"
>>               bodies))
>>      ;; these should be the teachpack requires:
>>      (define-values (teachpack-requires remaining-bodies)
>>        (split-at bodies num-requires))
>>      (unless (andmap require-form? teachpack-requires)
>>        (error 'flag-teachpack-requires
>>               "internal error: expected these to be teachpack requires: ~e"
>>               teachpack-requires))
>>      (define flagged-teachpack-requires
>>        (for/list ([tp-rq (in-list teachpack-requires)])
>>          (stepper-syntax-property stx 'stepper-ignore-completely #t)))
>>      #'(mod name lang
>>             #,@flagged-teachpack-requires
>>             #,@remaining-bodies))]))_________________________
>> Racket Developers list:
>> http://lists.racket-lang.org/dev
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_________________________
  Racket Developers list:
  http://lists.racket-lang.org/dev

Reply via email to