Arc Forumnew | comments | leaders | submitlogin
_list: bad syntax after require ffi/unsafe
4 points by highCs 3339 days ago | 6 comments
Hi,

  arc> ($:require ffi/unsafe)
  #<void>
  arc> (list 1 2 3)
  _list: bad syntax
    in: _list
    context...:
     d:\vrac\halfdwarf\ac.scm:1188:0: arc-eval
     d:\vrac\halfdwarf\ac.scm:485:0: ac-call
     d:\vrac\halfdwarf\ac.scm:1231:4
  arc>
Any idea how to solve this?

Thank you



5 points by rocketnia 3339 days ago | link

Arc implements its global variables in terms of Racket's global variables, using _ as a prefix to prevent name collisions. Racket's ffi/unsafe module actually exports a variable called _list, underscore and everything, so there's a name conflict after all.

One way to fix this might be to modify this code in ac.scm:

  (define (ac-global-name s)
    (string->symbol (string-append "_" (symbol->string s))))
If you change that underscore to something else, then Arc's global variables won't conflict with _list (but they might conflict with something else).

Another fix would be to change your require form so it doesn't create a variable called _list. For instance, I think this would work:

  arc> ($:require (prefix-in ffi/unsafe- ffi/unsafe))
Now the variable should be available (on the Racket side) as "ffi/unsafe-_list".

-----

2 points by highCs 3339 days ago | link

It works. Thank you very much. I should have found the solution by myself. I'll try to do better next time.

-----

3 points by zck 3339 days ago | link

> I should have found the solution by myself. I'll try to do better next time.

Screw that. Asking for help is just fine. You weren't sure what was going on, so you asked for help. (This is something I struggle with too). Forget what you "should" have done; you tried and when you needed help, you asked for it, with a very good, simple example that showed the problematic behavior.

Nothing wrong with that. At all.

-----

2 points by rocketnia 3339 days ago | link

Seconded! I'm sorry if I gave a "should have known" impression.

-----

1 point by highCs 3339 days ago | link

Oh you didn't. Absolutely not. I was thinking loudly here (I'm always trying to improve), nothing wrong with your answer. Thanks again for your help :)

-----

2 points by highCs 3339 days ago | link

Cool. I think you are right. Thanks.

-----