Hi,<br><br><div class="gmail_quote">2011/7/9 Roger Wilson <span dir="ltr"><<a href="mailto:misterrogerwilson@gmail.com">misterrogerwilson@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi,<br><br>That makes a lot of sense.  So my next question is how do I include Meroon into each source code file?<br></blockquote><div><br></div><div>Well, depends on if you want to administrate your code directly atop Gambit's (load) (compile-file) (##namespace) etc. or if you want to use a module system to abstract that away for you.</div>

<div><br></div><div>If the latter, (import meroon) should do it. (Though. I don't know if Meroon can be run atop the current version of Black Hole, as maybe Meroon would use some nonstandard ways of macro expansion. Check on the list if anyone did this, or if you have further questions about the feazibility of this ask Per.)</div>

<div><br></div><div>If the further, (include "meroon.scm") should (in a very basic usecase, see examples below for more complex examples where that feature a separation of code into header and code files).</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">As a more general question is there a good resource for learning about recommended methods for structuring, including, loading, linking, making macros visible etc?  I.e. actually building a non-trivial program spread across many source files. Alternatively are there any well structured complete programs I'd be recommended to inspect the source of?</blockquote>

<div><br></div><div>If you use Black Hole as a module system, it does the namespace handling and macro export work automatically. If you build your app atop Gambit's (load) etc you can study the examples/ dir in the Gambit distribution.</div>

<div><br></div><div>If using that module system, no examples to study needed.</div><div><br></div><div>If going with Gambit's (load) (compile-file) etc., you can study the examples/ dir in the Gambit distribution - other than that, how identifier exporting and macros go together with them is straight-forward, maybe the use of (##namespace) is nontrivial in some special cases duno.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
 Thanks,<br><font color="#888888"><br>Roger.</font></blockquote><div><br></div><div>Brgds</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div>

</div><div class="h5"><br><br><br><br><div class="gmail_quote">On Sat, Jul 9, 2011 at 2:11 PM, Mikael <span dir="ltr"><<a href="mailto:mikael.rcv@gmail.com" target="_blank">mikael.rcv@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Well you should still somehow get a ,be to the underlying gambit repl to check. Anyhow probably what's happening is that<div><div><br></div><div>(define-class my-object Object <br>  ((= object-id :initializer get-next-global-id)))</div>




<div><br></div></div><div>is interpreted by Gambit as three expressions in each other, and it starts evaluating the inner-most, so what you see down there is a complaint that object-id and :initializer are unbound - which is projected as the value #!unbound - which is indeed not a number.</div>




<div><br></div><div>This in turn probably happens because you didn't include Meroon ['s sources] into your Scheme environment (in this case: your sourcecode file) prior to using Meroon functionality (i.e. define-class etc.) .</div>




<div><br></div><div>Brgds<div><div></div><div><br><br><div class="gmail_quote">2011/7/9 Roger Wilson <span dir="ltr"><<a href="mailto:misterrogerwilson@gmail.com" target="_blank">misterrogerwilson@gmail.com</a>></span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi,<br><br>Thanks for the help, I'll try and clarify.  I'm actually using Swank rather than a REPL.<br><br>If I run my app, connect to it with Slime and evaluate the code below using 'slime-eval-region' then I can create instances of the my-object class using (instantiate my-object), and each object has a unique object-id.  I was happy with that during the early stage of development.  Now I'm trying to speed things up so I've put the code below in a scm file, I generate C code with 'gsc -link my_file.scm' and compile and link it in with my (OS X) app.  However when the Gambit setup function is called in my app I get the error.....    <br>




<div>
<br>*** ERROR IN | object| -- (Argument 1) NUMBER expected<br>(= #!unbound #!unbound 'get-next-global-id)<br><br></div>How can I convince Meroon to run the 'get-next-global-id ' function to generate an object-id each time I instantiate an object in the same way as when I was developing interactively? <br>




<font color="#888888">
<br>Roger.</font><div><div></div><div><br><br><br><div class="gmail_quote">On Sat, Jul 9, 2011 at 9:07 AM, Mikael <span dir="ltr"><<a href="mailto:mikael.rcv@gmail.com" target="_blank">mikael.rcv@gmail.com</a>></span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<div><br></div><div>As for the error you encountered, can you please do ,be in the REPL to see exactly what it is that failed.</div><div><br></div><div>Regarding how to make it work with a compiled file, can you please clarify what you mean by making it to work with a compiled file - i.e., what is it you are trying to achieve, and what part of it is it that you don't get to work currently?<br>







<br>Brgds,</div><div>Mikael<br><br><div class="gmail_quote"><div><div></div><div>2011/7/9 Roger Wilson <span dir="ltr"><<a href="mailto:misterrogerwilson@gmail.com" target="_blank">misterrogerwilson@gmail.com</a>></span><br>





</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>

Hi,<br><br>I have a basic Scheme question.<br><br>The following works as
 intended from my Swank REPL.  How do I make it work with a compiled 
file?  I'm trying to create a Meroon object that has an automatically 
created unique id each time one is created. <br>
<br>(define *global-id* 0)<br>(define (get-next-global-id) <br>    (let ((current-global-id *global-id*)) <br>         (set! *global-id* (+ *global-id* 1)) <br>         current-global-id))<br><br>(define-class my-object Object <br>










  ((= object-id :initializer get-next-global-id)))<br><br><br>When the Gambit setup function runs I get the error....<br><br>*** ERROR IN | object| -- (Argument 1) NUMBER expected<br>(= #!unbound #!unbound 'get-next-global-id)<br>







<font color="#888888">

<font color="#888888">
 <br><br>Roger.</font>
</font><br></div></div>_______________________________________________<br>
Gambit-list mailing list<br>
<a href="mailto:Gambit-list@iro.umontreal.ca" target="_blank">Gambit-list@iro.umontreal.ca</a><br>
<a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" target="_blank">https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br>
</div></div></blockquote></div><br>