Arc Forumnew | comments | leaders | submitlogin
Eliminate modules from ac.scm?
2 points by akkartik 5043 days ago | 5 comments
I'm having a hard time understanding PLT's module system in the context of arc.

Start with a temporary distro of arc. Get rid of the module and provides statements at the top of ac.scm, the trailing ')' at the bottom. In as.scm, replace (require "ac.scm") with (load "ac.scm").

I don't expect everything to work, but the place where it breaks is surprising:

  $ mzscheme -f as.scm
  _list: bad syntax in: _list
Does anybody know what this means? It's happening in arc.arc at the first use of arc's list -- inside pair -- soon after it's been defined.


1 point by akkartik 5031 days ago | link

I started out pruning ac.scm from the bottom up, stripping out everything but the core compiler - and the culprit ended up exactly at the top.

  (require (lib "foreign.ss"))
I assume the FFI does weird things with underscored variables that need to be sandboxed into a module before arc can take over such variables.

Update: I've uploaded a minimal arc implementation at http://gist.github.com/488376. May be easier to read than the canonical version. And I think it's portable R5RS now that it's not asking for the legacy mzscheme language.

-----

2 points by akkartik 5029 days ago | link

A simpler change to vanilla arc is to change the prefix for arc variables to two underscores rather than one.

  (define (ac-global-name s)
    (string->symbol (string-append "__" (symbol->string s))))
Surprisingly enough, the only other change required is to replace else in case expressions to (else). Now you can convert ac.scm into a simple file that can be load'ed.

-----

1 point by evanrmurphy 5042 days ago | link

Curious.

arc.arc's list definition looks like the first one to use a rest parameter, and pair is the first one with an optional parm. Could this have something to do with it?

-----

1 point by shader 5042 days ago | link

Just wondering, but why do you want to remove the module information?

-----

1 point by akkartik 5042 days ago | link

Part of my attempt at refactoring arc (http://arclanguage.org/item?id=11880) - I want to be able to split ac.scm into multiple files.

-----