* removing unused variables?
@ 2009-09-21 13:40 Andy Wingo
2009-09-21 15:08 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2009-09-21 13:40 UTC (permalink / raw)
To: guile-devel
Hello,
Unused variables are compiled away to only their side effects. Yet
sometimes they are good for documentation. As in this case:
------------------------- module/language/assembly.scm -------------------------
index 683da6c..95f8a2d 100644
@@ -49,7 +49,7 @@
(+ 1 *len-len* (string-length str)))
((load-array ,bv)
(+ 1 *len-len* (bytevector-length bv)))
- ((load-program ,nargs ,nrest ,nlocs ,labels ,len ,meta . ,code)
+ ((load-program _ _ _ _ ,len ,meta . _)
(+ 1 *program-header-len* len (if meta (1- (byte-length meta)) 0)))
((,inst . _) (guard (>= (instruction-length inst) 0))
(+ 1 (instruction-length inst)))
This is a bad change IMO. We should not contort our code to please some
mechanical idea of "good style".
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: removing unused variables?
2009-09-21 13:40 removing unused variables? Andy Wingo
@ 2009-09-21 15:08 ` Ludovic Courtès
2009-09-22 12:25 ` Andy Wingo
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2009-09-21 15:08 UTC (permalink / raw)
To: guile-devel
Hi,
Andy Wingo <wingo@pobox.com> writes:
> ------------------------- module/language/assembly.scm -------------------------
> index 683da6c..95f8a2d 100644
> @@ -49,7 +49,7 @@
> (+ 1 *len-len* (string-length str)))
> ((load-array ,bv)
> (+ 1 *len-len* (bytevector-length bv)))
> - ((load-program ,nargs ,nrest ,nlocs ,labels ,len ,meta . ,code)
> + ((load-program _ _ _ _ ,len ,meta . _)
> (+ 1 *program-header-len* len (if meta (1- (byte-length meta)) 0)))
> ((,inst . _) (guard (>= (instruction-length inst) 0))
> (+ 1 (instruction-length inst)))
>
>
> This is a bad change IMO. We should not contort our code to please some
> mechanical idea of "good style".
Oops, I actually agree with this one. Probably I should not have
committed it before discussion, or at least in a separate, easily
revertable commit. I apologize for not doing so.
I can revert the offending parts, which are all ‘pmatch’ invocations.
Would that be OK with you?
That said, in many cases unused variables are a sign of sloppiness IMO,
which was the reason I looked into it. However, having unused variables
“for style” and unused variables introduced by macros makes it harder to
identify “really unused” variables.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: removing unused variables?
2009-09-21 15:08 ` Ludovic Courtès
@ 2009-09-22 12:25 ` Andy Wingo
2009-09-23 22:12 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Andy Wingo @ 2009-09-22 12:25 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guile-devel
Hi Ludovic,
On Mon 21 Sep 2009 11:08, ludo@gnu.org (Ludovic Courtès) writes:
> Hi,
>
> Andy Wingo <wingo@pobox.com> writes:
>
>> ------------------------- module/language/assembly.scm -------------------------
>> index 683da6c..95f8a2d 100644
>> @@ -49,7 +49,7 @@
>> (+ 1 *len-len* (string-length str)))
>> ((load-array ,bv)
>> (+ 1 *len-len* (bytevector-length bv)))
>> - ((load-program ,nargs ,nrest ,nlocs ,labels ,len ,meta . ,code)
>> + ((load-program _ _ _ _ ,len ,meta . _)
>> (+ 1 *program-header-len* len (if meta (1- (byte-length meta)) 0)))
>> ((,inst . _) (guard (>= (instruction-length inst) 0))
>> (+ 1 (instruction-length inst)))
>>
>>
>> This is a bad change IMO. We should not contort our code to please some
>> mechanical idea of "good style".
>
> Oops, I actually agree with this one. Probably I should not have
> committed it before discussion, or at least in a separate, easily
> revertable commit. I apologize for not doing so.
>
> I can revert the offending parts, which are all ‘pmatch’ invocations.
> Would that be OK with you?
That would be great.
> That said, in many cases unused variables are a sign of sloppiness IMO,
> which was the reason I looked into it. However, having unused variables
> “for style” and unused variables introduced by macros makes it harder to
> identify “really unused” variables.
Yes, agreed with all of this.
Thanks! (And apologies if I sounded grumpy. Perhaps I had mailed before
coffee ;-)
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: removing unused variables?
2009-09-22 12:25 ` Andy Wingo
@ 2009-09-23 22:12 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2009-09-23 22:12 UTC (permalink / raw)
To: guile-devel
Hi Andy,
Andy Wingo <wingo@pobox.com> writes:
> On Mon 21 Sep 2009 11:08, ludo@gnu.org (Ludovic Courtès) writes:
>> I can revert the offending parts, which are all ‘pmatch’ invocations.
>> Would that be OK with you?
>
> That would be great.
Done.
> Thanks! (And apologies if I sounded grumpy. Perhaps I had mailed before
> coffee ;-)
No problem. ;-)
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-23 22:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-21 13:40 removing unused variables? Andy Wingo
2009-09-21 15:08 ` Ludovic Courtès
2009-09-22 12:25 ` Andy Wingo
2009-09-23 22:12 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).