Your response to 2 was really enlightening.<br><br>More on 3:<br><br>~:$ cat test.scm<br>(define source? 10)<br>(define ##source? 10)<br>(pp source?)<br>(pp ##source?)<br>~:$ gsi test.scm<br>10<br>10<br><br><br>This surprised me a bit ... initially, intuitively, I had a notion that ##blah was a blah that had it's value hard coded internally in gambit (so that even if the user did weird things to his/her environment, I can still get the 'system functions').<br>
<br>In gambit, are ##-vars treated just like regular ##-vars ?<br><br>I see the ##'s pop up alot in the gambit internal *.scm 's, and sometimes, changing a "##blah" to a "blah" results in the code behaving differently (iirc when I was trying to get the debugger to output a 'stack trace').<br>
<br><br><br><div class="gmail_quote">On Thu, May 7, 2009 at 6:48 AM, Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>></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;">
<div class="im"><br>
On 7-May-09, at 3:06 AM, lowly coder wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Let's see how much of this I can understand.<br>
<br>
1) FILE & LINE are macros.<br>
</blockquote>
<br></div>
Yes.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2) in (lambda (src <-- this variable here<br>
    the src is linked to the reader/parser object, which is why we can query it for the current line / file number?<br>
</blockquote>
<br></div>
Yes.  The parameter is the "source object" corresponding to the macro call.  What is a source object?  Here's a simple way to find out how source objects are represented:<br>
<br>
bash-3.2$ gsi<br>
Gambit v4.4.3<br>
<br>
> (define x #f)<br>
> (##define-syntax foo (lambda (src) (set! x src) '(begin)))<br>
> (foo (stuff) turkey)<br>
> x<br>
#(#(source1)<br>
  (#(#(source1) foo (console) 65538)<br>
   #(#(source1) (#(#(source1) stuff (console) 393218)) (console) 327682)<br>
   #(#(source1) turkey (console) 851970))<br>
  (console)<br>
  2)<br>
> (##source? x)<br>
#t<br>
> (##source-locat x)<br>
#((console) 2)<br>
> (##source-code x)<br>
(#(#(source1) foo (console) 65538)<br>
 #(#(source1) (#(#(source1) stuff (console) 393218)) (console) 327682)<br>
 #(#(source1) turkey (console) 851970))<br>
> (length (##source-code x))<br>
3<br>
> (##source-code (car (##source-code x)))<br>
foo<br>
> (##source-code (car (##source-code (cadr (##source-code x)))))<br>
stuff<br>
> (##desourcify x)<br>
(foo (stuff) turkey)<br>
> (##locat-container (##source-locat x))<br>
(console)<br>
> (##locat-position (##source-locat x))<br>
2<br>
> (##display-locat (##source-locat x) #t (current-output-port))<br>
(console)@3.1<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
3) Why the ##'s<br>
</blockquote>
<br>
All the ## names refer to internal functionality that should be used with great care, and is not meant for use by a casual user.  The procedures typically don't do any type checking and the API may change at any point.  The ## stresses these point in several ways:<br>

<br>
1) It is easy to spot in code, so a simple "grep '##' *.scm" will find places in your code that are possibly unsafe or brittle (over versions of Gambit).<br>
<br>
2) The ## prefix is "ugly" and may be a deterrent to using these names.<br>
<br>
3) The "##" prefix on symbols is illegal in Scheme, so it is clear that by using these names you are definitely non-portable to other Schemes (it turns out that Chicken Scheme supports this extension, so ## is not completely non-portable anymore).<br>
<font color="#888888">
<br>
Marc<br>
<br>
</font></blockquote></div><br>