[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: procedures with setters: patches
From: |
Nicolas Sceaux |
Subject: |
Re: procedures with setters: patches |
Date: |
Sat, 28 Feb 2004 10:38:29 +0100 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Sat, 28 Feb 2004 00:38:31 +0100, Han-Wen a dit :
> I like the stylistic patches. Jan always complains of my style, and
> he's probably right, but if you clean up after me, it frees me to do
> interesting stuff :-). Still, but I would prefer to handle them
> separately, i.e. try not to mix stylistic and real changes.
That's what I thought, but only after I made all the changes... that's
why they were all mixed.
I have some minor questions about style.
Should indentation be tabified, or untabified (I refer to the emacs
commands)? This time, I have done a C-x h M-x tabify, but in previous
patches, they were untabified.
When a pattern is encountered a few times, it is common pratice to
write a macro that will expand to that pattern. For instance:
(define-public (make-grob-property-set grob gprop val)
"Make a Music expression that sets GPROP to VAL in GROB. Does a pop first,
i.e. this is not an override"
(let ((m (make-music-by-name 'OverrideProperty)))
(set! (ly:music-property m 'symbol) grob)
(set! (ly:music-property m 'grob-property) gprop)
(set! (ly:music-property m 'grob-value) val)
(set! (ly:music-property m 'pop-first) #t)
m))
looks like:
(define-public (make-grob-property-revert grob gprop)
"Revert the grob property GPROP for GROB."
(let ((m (make-music-by-name 'OverrideProperty)))
(set! (ly:music-property m 'symbol) grob)
(set! (ly:music-property m 'grob-property) gprop)
m))
and there are several other occurences of that pattern. There could be
something that will allow to write, for instance:
(define-public (make-grob-property-set grob gprop val)
"..."
(make-music-by-name-and-props OverrideProperty
symbol grob
grob-property gprop
grob-value val
pop-first #t)) ;; or maybe quoted/keyworded property names...
which imho improves readability.
Although that's not purely stylistic, are you interested in such
changes?
nicolas