<div dir="ltr">Thanks for the guidance Alex, this is really helpful!  It makes sense that the documentation is on <a href="http://mozilla.org">mozilla.org</a>, but I appreciate the direct link.  I'll take a look at that and how it's being used in the interpreter.<div>
<br></div><div style>I plan to try using RequireJS to deal with loading scripts, and that will probably handle the evalWithLocation issue.  I'll update this thread if that works.</div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Wed, Feb 27, 2013 at 10:33 AM, Alex Beal <span dir="ltr"><<a href="mailto:alexlbeal@gmail.com" target="_blank">alexlbeal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Donn,<div><br></div><div>This sounds like an interesting project! I'd be interested to see where it goes! Here's what I know:<br><div><br></div><div>Proxy is a nonstandard API supported by SpiderMonkey. It allows you to change the semantics of an object from within your program. This is similar to Python's special methods like __getattr__, where you can customize how attributes are looked up. The MDN page has more info: <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Proxy" target="_blank">https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Proxy</a> I believe narcissus is using the old version of the API: <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Old_Proxy_API" target="_blank">https://developer.mozilla.org/en-US/docs/JavaScript/Old_Proxy_API</a></div>


<div><br></div><div>Unfortunately, since this modifies the semantics of the language, it means you can't implement it in JS (as far as I know).</div><div><br></div><div>Another option would be to use Zaphod, which runs Narcissus in Firefox: <a href="https://github.com/taustin/Zaphod/" target="_blank">https://github.com/taustin/Zaphod/</a></div>


</div><div><br></div><div>I'm not sure how best to deal with evalWithLocation.</div><div><br></div><div>Best,</div><div>Alex</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">

On Tue, Feb 26, 2013 at 10:09 PM, Donn Denman <span dir="ltr"><<a href="mailto:donn.denman@gmail.com" target="_blank">donn.denman@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">

<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Over the weekend I ported Narcissus to run in a Chrome web page, but ran into a few issues that I'd like help with.  Most of the changes that needed to be made were straightforward, but I still need help with two of them.  Any advice or suggestions would be appreciated!</span><div style="font-family:arial,sans-serif;font-size:13px">




<div><ol><li style="margin-left:15px">There's a reference to a "Proxy" in interpreter.js that I don't recognize.  Is there a JS implementation, or a definition of the API for this object somewhere that I can use to implement something reasonable?  I wrote a tiny stub that's probably completely wrong, with methods for create() and createFunction() that were mere wild guesses.</li>




<li style="margin-left:15px">I don't have any evalWithLocation method, so the fallback to regular eval is being used, which works OK until I run into errors.  Is there a JS implementation for evalWithLocation that I could use instead, or does someone have an idea for how it could be written fairly easily in JS?  It looks like using RequireJS might be a better way to load the Narcissus scripts than using evalWithLocation -- does anyone know if Narcissus works with RequireJS?</li>




</ol><div>Details on the changes I made for Narcissus to run in a Chrome client, in case other folks end up trying something similar:<br></div></div><div><ul><li style="margin-left:15px">Added Narcissus source files to my AppEngine server.</li>




<li style="margin-left:15px">Implemented a read() method in JavaScript to return the Narcissus source files (prefetched from my server).  Maybe using RequireJS would be better? (<a href="http://requirejs.org/" target="_blank">http://requirejs.org/</a>).  </li>



<li style="margin-left:15px">Used the SpiderMonkey shell.js and init.js files to shim the other CommonJS requirements, like require().</li>
<li style="margin-left:15px">Changed occurrences of "<font face="courier new, monospace">let</font>" to "<font face="courier new, monospace">var</font>" because Chrome doesn't seem to recognize the "let" keyword.</li>




<li style="margin-left:15px">Changed occurrences of "<font face="courier new, monospace">catch (e if e ...</font>" to "<font face="courier new, monospace">catch (e) { if (e ... }</font>" because Chrome complains about these constructs too.</li>




<li style="margin-left:15px">Wrote the Proxy stub (referenced above).</li></ul><div>Some background on my project: I want to experiment with different language control structures, such as state-machines and spreadsheet-style dependency trees.  I'd like to build an IDE that can run in any browser to allow building simple web-based games using these language features, in order to get a feel for the pros and cons of these new constructs.  Starting with JavaScript as a base language seemed like a good idea, but it's taken me a while to find the right hackable JavaScript.  Over the weekend I discovered Narcissus, and it seems like a pretty good fit for these goals!</div>




<div><br></div><div>I'm really glad that Narcissus is available, and open source!  It looks like it will be fun to play with.</div></div></div></div>
<br></div></div>_______________________________________________<br>
Narcissus mailing list<br>
<a href="mailto:Narcissus@mozilla.org" target="_blank">Narcissus@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/narcissus" target="_blank">https://mail.mozilla.org/listinfo/narcissus</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>