GSOC | Extending Common Lisp support
Per Bothner
per@bothner.com
Sat Jun 2 01:11:00 GMT 2012
On 06/01/2012 05:55 PM, Charles Turner wrote:
> On 1 June 2012 00:02, Per Bothner<per@bothner.com> wrote:
>> Note that funcall is a function, not a macro. It should be easy enough to
>> implement as a short Java method or a CommonList function that
>> invokes Procedure#applyN.
>
> I implemented this using the APPLY function in primitives.lisp:
>
> (defun apply (func&rest (args ::<Object[]>))
> (invoke (the<function>
> (if (symbolp func) (symbol-function func) func))
> 'applyN
> (invoke-static<gnu.kawa.functions.Apply>
> 'getArguments
> args
> 0 #'apply)))
>
> (defun funcall (func&rest args)
> (apply func args))
Seems reasonable, at least for now.
> Passes the examples given in the hyperspec at least.
Remember to create test-cases!
Jamison, maybe you can put together a patch to use RunTestScript,
including a started test and gnu/commonlisp/testsuite/Makefile.am
changes?
>> where %flet is implemented using kawa.standard.let,
>> except you need to do:
>> decl.setProcedureDecl(true);
>
> I'd be inclined to do a dispatch on the syntax name, so in the
> protected method something like:
>
> if (this.getName().equals("flet")) then decl.setProcedureDecl()
>
> but that's quite awkward with the static instances being used in these
> syntax objects. What's the motivation for the static instances in
> these syntax objects?
The static instances are the ones that end up in the builtin environment.
> I added constructors which set the syntax name
> per object,
Yes, that is certaily appropriate, especially when it is no longer
a singleton class.
> and it seems to work OK, though I haven't tested whether
> my FLET satisfies the semantics of the standard yet, but the method of
> implementing it seems to work.
However, instead of:
if (this.getName().equals("flet")) then decl.setProcedureDecl();
do something like:
if (settingProcedures) decl.setProcedureDecl();
and have settingProcedures an instance variable which can be
set in the constructor.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Kawa
mailing list