<div dir="ltr">On Tue, Aug 2, 2011 at 21:09, Edward Z. Yang <span dir="ltr">&lt;<a href="mailto:ezyang@mit.edu">ezyang@mit.edu</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Excerpts from Victor Nazarov&#39;s message of Tue Aug 02 19:12:55 -0400 2011:<div class="im">
&gt; But GHC always emit parse error on &quot;javascript&quot; keyword.<br>
&gt;<br>
&gt; For now I&#39;m using (abusing) ccall calling convention and simple<br>
&gt; imports works pretty well, but I would like to support<br>
&gt; exports and static/dynamic wrappers. GHC generates C-code to support<br>
&gt; them, and GHCJS should generate Javascript-code,<br>
&gt; but I have no idea how to use GHC API to generate custom (Javascript)<br>
&gt; stubs. Is it possible at all?<br>
<br>
</div>That is certainly not; you&#39;ll need to patch GHC&#39;s lexer to do that.<br>
But it&#39;s all a bit dodgy since this FFI doesn&#39;t make sense unless you are<br>
generating Javascript code (which GHC is not.)  Maybe someone else can<br>
comment on that. (Perhaps we need fully extensible calling convention<br>
syntax? Hmmm!)<br></blockquote><div><br></div><div>If making it a backend isn&#39;t acceptable then it&#39;s a bit of a lost cause; I&#39;d expect it to be a backend, with backend hooks to support various -f* options (probably already exists) and the foreign syntax changed from expecting a keyword to expecting an identifier and optional parenthesized identifier list (the same syntactic category as import and export lists, &quot;deriving&quot; clauses, etc.), and that would be passed to the backend.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">&gt; I&#39;d like to create ghcjs and ghcjs-pkg tools that will use their own<br>
&gt; directories and package index and will<br>
&gt; not interfere with ghc. Is it possible with GHC API? How can I do it?<br>
<br>
</div>Check out the approach that cabal-dev uses, which is about what you<br>
are looking for here.  (Though, handling base packages might be tricky.)<br></blockquote><div><br></div><div>And I&#39;d point out that this sounds similar to another recently reported shortcoming of ghc-pkg (mentioned in the context of cabal&#39;s dependency calculations but I miscall the details at the moment).  I would expect JS packages to register a dependency on a version of base specific to the JS backend, and that dependency would prevent libraries using the standard base package from being considered.</div>
<div><br></div></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br>
<br>
</div>