Opened 12 years ago

Closed 12 years ago

#40 closed defect (fixed)

Non-constant function-argument initforms

Reported by: ehuelsmann Owned by: ehuelsmann
Priority: major Milestone:
Component: compiler Version:
Keywords: Cc:
Parent Tickets:

Description

The compiler doesn't support non-constant initforms for compiled functions. One way to work around this would be to take advantage of the existing processArgs() functionality in Closure.java. It's used by the interpreter to evaluate non-constant initforms.

In order to re-use the functionality, the compiler would need to create an Environment object and set it up with the variables used in the initforms for the interpreter to access.

This can be done by removing the CompiledClosure? wrapper around ClosureTemplateFunction?. The ClosureTemplateFunction? should support being .execute()-ed directly (instead of through the wrapper). The compiler should then set a context record (array of LispObjects?) currently carried around in CompiledClosure? directly in ClosureTemplateFunction?. The Environment object should be used to set the 'environment' field in ClosureTemplateFunction?.

Change History (2)

comment:1 Changed 12 years ago by ehuelsmann

Current progress is:

  • CTF is now used directly instead of being wrapped.
  • Once a CTF has been loaded/created, it's duplicated using clone()
  • After cloning, the context record is set to the desired value.

Remain a number of things to do:

  • analyse initforms for the variables they use
  • create the environment object using this information

comment:2 Changed 12 years ago by ehuelsmann

Resolution: fixed
Status: newclosed

Fixed by rewriting the lambda list into a series of let* forms, using the SUPPLIED-P argument to determine whether to evaluate the initform or not.

Note: See TracTickets for help on using tickets.