Re: Trouble trying to understand how low level macros interact with module system.

"Mike J. Bell" <[email protected]> Sun, 30 Nov 2008 07:50:54 -0500
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
--===============2342941792829490309==
Content-Type: multipart/alternative; 
	boundary="----=_Part_53743_26680526.1228049454678"

------=_Part_53743_26680526.1228049454678
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Whoops...I didn't try mine in a clean environment (did yours, then mine, and
my macro somehow found the new thefunc the second time...I should have
started in a new interpreter to test).

Sorry!

Mike

On Sun, Nov 30, 2008 at 7:44 AM, Igor Hjelmstrom Vinhas Ribeiro <
[email protected]> wrote:

> Hello, Mike - thanks for the reply!
>
>    Unfortunately, however, this also doesn't work[1]:
>
>    Any other clue on what could be wrong?
>
> Regards,
>  Igor.
>
> [1]. See below - trying Mike's suggestion. As before, calls to
> amacro fail stating that thefunc is undefined, while direct calls
> to thefunc work just fine.
>
> SISC (1.16.6)
> #;> (max-stack-trace-depth 16)
> 0
> #;> (module ((thefunc) (amacro thefunc))
>   (define-macro amacro (lambda () (thefunc)))
>   (define (thefunc) (display "\n\n---\n\n")))
> #;> (amacro)
> Error: undefined variable 'thefunc'.
> ---------------------------
> Some stack trace entries may have been suppressed. To see all entries set
> the dynamic parameter suppressed-stack-trace-source-kinds to '().
> #;> (thefunc)
>
>
> ---
>
> #;>
>
> On Sat, Nov 29, 2008 at 23:53, Mike J. Bell <[email protected]> wrote:
>
>> Try:
>>
>> (module ((thefunc) (amacro thefunc))
>>   (define-macro amacro (lambda () (thefunc)))
>>   (define (thefunc) (display "\n\n---\n\n")))
>>
>> This (I think) means make an anonymous module with two exported symbols,
>> thefunc and amacro (which depends on thefunc).
>>
>> Somebody else can I'm sure give you a better theoretical reason why this
>> works (and what it really means, and why yours does what it does, which
>> isn't very intuitive to me off hand).
>>
>> Mike
>>
>>
>>  On Sat, Nov 29, 2008 at 8:02 PM, Igor Hjelmstrom Vinhas Ribeiro <
>> [email protected]> wrote:
>>
>>>  Hello!
>>>
>>>    I am trying to understand how the module system used by SISC
>>> interacts with the low-level macros that SISC supports.
>>>
>>>   Specifically, I am trying to figure out why the follow snippet of
>>>   code, an anonymous module that exports amacro and thefunc,
>>>   doesn't work.
>>>
>>>    (module (amacro thefunc)
>>>      (define-macro amacro (lambda () (thefunc)))
>>>      (define (thefunc) (display "\n\n===\n\n")))
>>>
>>>   After I pasted it in the REPL, when I call (amacro) I get:
>>>
>>>    #;> (amacro)
>>>    Error: undefined variable 'thefunc'.
>>>    console:16:7: <indeterminate call>
>>>
>>>   Curiously, if I just go ahead and type (thefunc) it works:
>>>
>>>    #;> (thefunc)
>>>
>>>
>>>    ===
>>>
>>>    #;>
>>>
>>>    Is anyone able to explain to me why this happens?
>>>
>>> Regards,
>>>  Igor.
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Sisc-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/sisc-users
>>>
>>>
>>
>>
>> --
>> Mike J. Bell on gmail
>>
>
>


-- 
Mike J. Bell on gmail

------=_Part_53743_26680526.1228049454678
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Whoops...I didn&#39;t try mine in a clean environment (did yours, then mine, and my macro somehow found the new thefunc the second time...I should have started in a new interpreter to test).<br><br>Sorry!<br><br>Mike<br><br>
<div class="gmail_quote">On Sun, Nov 30, 2008 at 7:44 AM, Igor Hjelmstrom Vinhas Ribeiro <span dir="ltr">&lt;<a href="mailto:[email protected]">[email protected]</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello, Mike - thanks for the reply!<br><br>&nbsp;&nbsp; Unfortunately, however, this also doesn&#39;t work[1]:<br><br>&nbsp;&nbsp; Any other clue on what could be wrong?<br><br>Regards,<br>&nbsp;Igor.<br><br>[1]. See below - trying Mike&#39;s suggestion. As before, calls to<br>

amacro fail stating that thefunc is undefined, while direct calls<br>to thefunc work just fine.<br><br>SISC (1.16.6)<br>#;&gt; (max-stack-trace-depth 16)<br>0<br>#;&gt; (module ((thefunc) (amacro thefunc))<div class="Ih2E3d">
<br>&nbsp; (define-macro amacro (lambda () (thefunc)))<br>
&nbsp; (define (thefunc) (display &quot;\n\n---\n\n&quot;)))<br></div><div class="Ih2E3d">#;&gt; (amacro)<br>Error: undefined variable &#39;thefunc&#39;.<br></div>---------------------------<br>Some stack trace entries may have been suppressed. To see all entries set the dynamic parameter suppressed-stack-trace-source-kinds to &#39;().<br>

#;&gt; (thefunc)<br><br><br>---<br><br>#;&gt; <br><div><div></div><div class="Wj3C7c"><br><div class="gmail_quote">On Sat, Nov 29, 2008 at 23:53, Mike J. Bell <span dir="ltr">&lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Try:<br><br>(module ((thefunc) (amacro thefunc))<div><br>&nbsp; (define-macro amacro (lambda () (thefunc)))<br>&nbsp; (define (thefunc) (display &quot;\n\n---\n\n&quot;)))<br><br></div>This (I think) means make an anonymous module with two exported symbols, thefunc and amacro (which depends on thefunc).<br>


<br>Somebody else can I&#39;m sure give you a better theoretical reason why this works (and what it really means, and why yours does what it does, which isn&#39;t very intuitive to me off hand).<br><br>Mike<br><br><br><div class="gmail_quote">

<div><div></div><div>
On Sat, Nov 29, 2008 at 8:02 PM, Igor Hjelmstrom Vinhas Ribeiro <span dir="ltr">&lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div></div><div>
Hello!<br><br>&nbsp;&nbsp; I am trying to understand how the module system used by SISC<br>interacts with the low-level macros that SISC supports.<br><br>&nbsp; Specifically, I am trying to figure out why the follow snippet of<br>&nbsp; code, an anonymous module that exports amacro and thefunc,<br>



&nbsp; doesn&#39;t work.<br><br>&nbsp;&nbsp; (module (amacro thefunc)<br>&nbsp; &nbsp;&nbsp; (define-macro amacro (lambda () (thefunc)))<br>&nbsp; &nbsp;&nbsp; (define (thefunc) (display &quot;\n\n===\n\n&quot;)))<br><br>&nbsp; After I pasted it in the REPL, when I call (amacro) I get:<br>



<br>&nbsp;&nbsp; #;&gt; (amacro)<br>&nbsp;&nbsp; Error: undefined variable &#39;thefunc&#39;.<br>&nbsp;&nbsp; console:16:7: &lt;indeterminate call&gt;<br><br>&nbsp; Curiously, if I just go ahead and type (thefunc) it works:<br><br>&nbsp;&nbsp; #;&gt; (thefunc)<br><br>



<br>&nbsp;&nbsp; ===<br><br>&nbsp;&nbsp; #;&gt; <br><br>&nbsp;&nbsp; Is anyone able to explain to me why this happens?<br><br>Regards,<br><font color="#888888">&nbsp;Igor.<br>
</font><br></div></div>-------------------------------------------------------------------------<br>
This SF.Net email is sponsored by the Moblin Your Move Developer&#39;s challenge<br>
Build the coolest Linux based applications with Moblin SDK &amp; win great prizes<br>
Grand prize is a trip for two to an Open Source event anywhere in the world<br>
<a href="http://moblin-contest.org/redirect.php?banner_id=100&amp;url=/" target="_blank">http://moblin-contest.org/redirect.php?banner_id=100&amp;url=/</a><br>_______________________________________________<br>
Sisc-users mailing list<br>
<a href="mailto:[email protected]" target="_blank">[email protected]</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/sisc-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/sisc-users</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>Mike J. Bell on gmail<br>
</font></blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Mike J. Bell on gmail<br>

------=_Part_53743_26680526.1228049454678--


--===============2342941792829490309==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
--===============2342941792829490309==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Sisc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisc-users

--===============2342941792829490309==--