kawa-commonlisp-dev
[Top][All Lists]
Advanced

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

Re: [Kawa-commonlisp-dev] [PATCH] DECLARE processing.


From: Jamison Hope
Subject: Re: [Kawa-commonlisp-dev] [PATCH] DECLARE processing.
Date: Tue, 14 Aug 2012 16:22:25 -0400

On Aug 14, 2012, at 3:49 PM, Charles Turner wrote:

On 14 August 2012 19:30, Per Bothner <address@hidden> wrote:
A minor style issue:  If local variable has a single assignment,
you should normally combine the declaration and initialization.
For example aliasedDecl - and others.

OK. I always thought it was more efficient to instead of

while (,,)
 Object o = ...

Have:

Object o;
while (,,,)
 o = ...

From an experiment, I now think it makes no difference, apart from
being slightly harder to read!

I think that used to be true, or maybe it's true (or was long ago) only
for certain languages/compilers.  I have a feeling a lot of those rules
of thumb are just hand-me-downs from the C compilers of 30 years ago.

I think this could be avoided by making rewriteBody protected, and
changing process processDeclare to something like:

 @Override
 protected void makeBody (LList forms)
 {
    ...
    letexp = letDone(super.rewriteBbody(body));
    formStack.add(letExp);
 }

Not sure if some variant will work, but it seems it might be
worth a try.

I'm not sure if you made a typo above, I found it difficult to
understand what you meant. I've updated the patch to do something
similar, apologies in advance if I've botched it.

In a void-returning method like rewriteBody, what's the best way to
signal a syntax error? The methods I know about from Compilation push
the handling of error messages for later, are there any that just bail
out immediately? There's a FIXME: in the attached patch signaling an
area where I'd like this behavior.

I wasn't sure what he meant, either, but I think you got it right.
I don't see the FIXME you mentioned, though (at least not in so many
words).  Is it this comment?

+        // if declIterator.next() is not an instance of Pair, fail.



--
Jamison Hope
The PTR Group
www.theptrgroup.com






reply via email to

[Prev in Thread] Current Thread [Next in Thread]