Arc Forumnew | comments | leaders | submitlogin
2 points by eds 6142 days ago | link | parent

The problem ended up being that the definition (xdef 'ref ...) was missing from arc-exe.scm for some reason. Copying it over from ac.scm fixed all the problems I was encountering. Pushed the fix to Anarki.


3 points by nex3 6142 days ago | link

That would be because I defined ref, and only thought to put it in ac.scm. We should come up with a way of dealing with this. I suppose we could admonish everyone to make changes to both files, but that seems a little annoying and apt to fall victim to forgetfulness.

Would you be willing to take on the responsibility of running "git log ac.scm" periodically and copying stuff over?

-----

2 points by almkglor 6142 days ago | link

Wouldn't it be possible for arc-exe to just (load "ac.scm") somewhere? Admittedly I don't know enough about the mzscheme compilation process to figure out why it won't work that way - something to do with modules not being able to use (load ...), maybe?

-----

1 point by sacado 6142 days ago | link

No, it's not possible. There are problems with mzscheme's namespaces. I had to fight with them to make arc-exe work, and simply importing ac.scm in an englobing file will just not work.

-----

3 points by almkglor 6142 days ago | link

Hmm. How about a macro which reads in the code from ac.scm and inserts it into a progn form? Would that work?

  (defsyntax insert-file-here ()) ; dunno, never figured out scheme macros

  (module arc-exe mzscheme
    (insert-file-here "ac.scm")
  )
Where (insert-file-here "ac.scm") would expand to:

  (progn
    (provide (all-defined))
    ...
    (define (ac s env)
    ...)
  )
Would putting the defines in (progn ...) work? Sorry, I'm not very good at macros in scheme, never managed to grok hygiene.

The alternative is to have the macros generate the (module ...) code, and insert the code inside the modules of ac.scm and as.scm and what else arc needs.

Basically what I'm proposing is writing a macro which does what you originally did in creating arc-exe.scm. The unfortunate part is that I never managed to grok Scheme macros, otherwise I'd offer to do it for you if you describe how you built arc-exe.scm.

-----

3 points by sacado 6142 days ago | link

Looks like an excellent proposition. I'm not very good with scheme macros either, however I think mzscheme has an à la Common Lisp define-macro extension. I'll look about that more precisely.

-----

1 point by eds 6141 days ago | link

Is it really namespaces that are a problem, or modules?

I hacked together a short version of arc-exe.scm that worked just fine importing from ac.scm. The only problem with that version was that it wasn't a module, and thus couldn't be compiled by mzc. I couldn't make it a module because scheme complained when brackets.scm tried to override read and read-syntax. (Apparently overriding imported bindings only works outside modules.) And when I tried to modify or not include brackets.scm, it would complain that it couldn't find the module ac.

So did you encounter this particular problem or something else? My guess is that if I could make brackets.scm behave, I could make the rest of it fall in line. But maybe I am mistaken about this.

-----

2 points by eds 6142 days ago | link

Me? I'd be fine with that.

-----