Arc Forumnew | comments | leaders | submitlogin
1 point by greatness 5918 days ago | link | parent

Excellent, could we get some sort of separate forum to talk about this project though to discuss bugs, recent patches, etc.. I noticed you have a module system up now, but I can't get it to work:

  arc> (impas blah spec)
  #3(tagged mac #<procedure>)
  arc> (blah:do2 nil nil nil)
  Error: "reference to undefined identifier: _blah"
And I'm not sure why it doesn't work, but I also have an Idea for a more general impas function:

  (mac impas mods 
    (do (map [apply importmodule _] (pair mods)) 
          nil))
(keep in mind this is entirely theoretical, I couldn't physically test it because the other impas didn't work.)


1 point by randallsquared 5918 days ago | link

The import.arc stuff is a sketch. One of it's many shortcomings is that if you define a function blah and then use it from inside the same module/file, it won't be able to find blah, because it's been silently renamed |modulename blah| .

The problem you're having seems to be different, though.

After looking, I realize that my testing process was masking a bug where I didn't change some symbol dereference. It's fixed now on my machine, but I'm new to git, and not sure what I need to do to make it show up in the repository. I did git push, but that doesn't seem to have made it appear in the commit list.

EDIT: okay, nex3 helpfully explained things to me, so this fix is in the arc-wiki repo now. It still doesn't change use points, though, as mentioned above.

-----

1 point by randallsquared 5918 days ago | link

Replying to myself because it seems as good a place as any...

We could walk the tree of a module and patch up any symbols we find that were referenced in a def or mac, but that's not a clean solution, since it can't find all actual calls (something could be building up names, for example, which we'd never find by walking the tree).

What this means is that any module system built right now, as far as I can tell, will have to require support from those writing the modules, but since renaming modules is implicit in how import.arc works at the moment, there's no way to know what the call should look like, for the module programmer. I can't see any way around this except to change Arc itself to make function and macro definitions respect lexical boundaries, rather than all being bound at the top level. Until that change is made, all we can do is fake a module system.

-----

1 point by randallsquared 5917 days ago | link

My own thought was that we'd have an

    (impfrom modulename name1 name2 ...) 
such that only those names would be imported, like Python's

    from modulename import name1
and that then impas would be extended to take given names as well, like

    (impas newname modulename name1 name2 ...)
However, I don't feel strongly about it either way.

-----

1 point by nex3 5917 days ago | link

I think this forum is as good as any for now.

-----