[Ecls-list] Macros impossible in compiled function

Peter Enerccio enerccio at gmail.com
Mon Dec 10 23:58:11 UTC 2012


Macrolet will make possible to do local macros, which are fine, but this is
not what I meant.
What I wanted is to define macros "safely", because the code is evaluated
in different thread with safe symbols, thus it is first saved
as lazy function.

Would it be possible (with regards to modification of defmacro), with any
internal (si) ecl functions/c functions (because I think its not possible
with ansi common lisp) to create macro
at any time (which could be registered in global environment).

Thanks.


2012/12/11 Juan Jose Garcia-Ripoll <juanjose.garciaripoll at gmail.com>

> Your code is incorrect. The defmacro is not a toplevel form and thus the
> definition is not available for the statement that follows it. Use macrolet
> instead.
> El 10/12/2012 23:28, "Peter Enerccio" <enerccio at gmail.com> escribió:
>
>> Hello, I dont know if this is related to the common lisp or the ecl,
>> but imagine code like this, compiled into function:
>>
>> (LAMBDA ()
>>   (LET ((CORE::P *PACKAGE*) (CORE:THIS #<a GAME:CUBE>))
>>     (IN-PACKAGE ANCA)
>>     (HANDLER-CASE
>>      (UNWIND-PROTECT
>>          (PROGN
>>           (PROGN
>>            (DEFMACRO ANCA::RUNNABLE (&BODY ANCA::BODY)
>>              (SI:QUASIQUOTE (LAMBDA () (SI:UNQUOTE-SPLICE ANCA::BODY))))
>>            ((ANCA::RUNNABLE (PRINT "Ahoj")))))
>>        (SETF *PACKAGE* CORE::P))
>>      (T (CORE::X)
>>       (FUNCALL
>>        #<bytecompiled-closure #<bytecompiled-function 00000000032387d0>>
>>        #<a GAME:CUBE>
>>        CORE::X)))
>>     T))
>>
>> which will work fine, until it will be run, where it will crash with
>>
>> ;;; Loading #P"/usr/lib/ecl-12.12.1/cmp.fas"
>> ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
>> ;;;
>> ;;; Error:
>> ;;;   * (ANCA::RUNNABLE (PRINT "Ahoj")) is not a legal function name.The
>> variable C::GAZONK is unbound.
>>
>> I have no idea what C::GAZONK is, but I imagine that it is not
>> recognizing macro made with the defmacro before?
>>
>> The problem is, that I need to save this into lambda so it is evaluated
>> later, not right now (and definitely not in this thread).
>>
>> --
>> Bc. Peter Vaňušanik
>> http://www.bishojo.tk
>>
>>
>>
>> ------------------------------------------------------------------------------
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> http://p.sf.net/sfu/logmein_12329d2d
>> _______________________________________________
>> Ecls-list mailing list
>> Ecls-list at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ecls-list
>>
>>


-- 
Bc. Peter Vaňušanik
http://www.bishojo.tk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20121211/b73bf1b5/attachment.html>


More information about the ecl-devel mailing list