GSOC | Extending Common Lisp support
Jamison Hope
jrh@theptrgroup.com
Sat Jun 2 05:44:00 GMT 2012
On Jun 1, 2012, at 9:10 PM, Per Bothner wrote:
> 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.
Ah yes, of course.
>> I implemented this using the APPLY function in primitives.lisp:
>> (defun funcall (func&rest args)
>> (apply func args))
>
> Seems reasonable, at least for now.
That does seem pretty equivalent to me, so ...
>> Passes the examples given in the hyperspec at least.
... if that includes the wacky
(flet ((cons (x y) `(kons ,x ,y)))
(let ((cons (symbol-function '+)))
(funcall #'cons
(funcall 'cons 1 2)
(funcall cons 1 2))))
=> (KONS (1 . 2) 3)
then we're probably OK.
> Remember to create test-cases!
Yes. The examples in CLHS are a good place to start.
> Jamison, maybe you can put together a patch to use RunTestScript,
> including a started test and gnu/commonlisp/testsuite/Makefile.am
> changes?
OK, I guess it's time to bite the bullet and figure out automake... ;-)
>>> 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.
+1
Note that labels is the letrec-like version of flet and should also
do the setProcedureDecl() bit.
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
--
Jamison Hope
The PTR Group
www.theptrgroup.com
More information about the Kawa
mailing list