This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GSOC | Extending Common Lisp support



On Apr 24, 2012, at 6:09 PM, Charles Turner wrote:


On 24 April 2012 08:30, Jamison Hope <jrh@theptrgroup.com> wrote:
Congratulations to you, sir!

Thank you :)


We already touched on this a little bit in a previous message, but: as
you're working on this, I encourage you to strive to make things as
broadly reusable as possible.

I had noticed these things, I already tried refactoring getNamedType, but it's not as straightforward as I initially thought. I'm going to try and get DECLARE's scoping working first, before sorting this out.

Yeah, don't get too hung up on it. Like I said, for now, the proper response might just be to add a FIXME comment and move on.

================

Following on from the DECLARE discussion, I tried creating let
expressions for DECLARE'd bindings.

Here's my latest approach in processTypeDeclArgs along with what I
think each line is doing:

for each declaration:

letStart(); // create a new lexical environment
ReferenceExp ref = new ReferenceExp(decl); // decl the x in a
(declare (integer x))
letVariable(decl, ref); // push x into this new lexical environment
this.lexical.push(decl); // not sure why this is necessary,
Jamison's advice (I think!)

If you're creating a new let via Compilation#letStart() and going the
letVariable()/letEnter()/letDone() route, then you don't need to explicitly
do the lexical.push(). I had just mentioned that in case you were going
to reuse an existing let for which letEnter() had already been called --
in that case, you'd need to call let.add(decl) as well as lexical.push(decl)
in order to simulate the letVariable()/letEnter() calls.


For example:

(let () <--------------------------------------------------------------\
(declare (foo x)) ...) <- when processing this declare, reusing this let ^



But by calling letStart() / letVariable() / letEnter(), you're rewriting as:


(let ()                    // LET1
  (let ((x ::foo x)) ...)  // LET2

and letEnter() [corresponding to LET2] will automatically do the lexical.push(),
so it's probably wrong to manually call it there -- it'll get pushed twice but
only popped once (in letDone()).



       letEnter(); // push this let expr in the lexical environment
       decl.setType(this.exp2Type((Pair) typeList)); // set the type
of x in this lexical environment
       decl.setFlag(Declaration.TYPE_SPECIFIED);
       letexp = letDone(rewrite_body(body)); // this is dodgy, seems
necessary to finish up a LET

[snip]


I can't look into this right now, gotta be across town in 10 minutes.
Sorry! Anybody else want to take a look? I might have time later tonight
but no guarantee...

-Jamie

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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]