Arc Forumnew | comments | leaders | submitlogin
2 points by pau 6116 days ago | link | parent

I probably didn't make myself clear... It's like in Python:

  from long-named-module import foo1, foo2, foo3
would be

  (use* '(foo1 foo2 foo3) 'long-named-module)
With this, you use (foo1 ...), etc. without the module name.


1 point by almkglor 6116 days ago | link

Sorry, I've been studiously avoiding Python. Can you give better examples, such as a module being used by another module?

-----

3 points by pau 6116 days ago | link

File 'a.arc':

  (set spam 1)
  (def myfun (x) (prn x))
File 'b.arc':

  ;; Uses 'a'
  (use 'a)
  (a@myfun "hi!")
File 'c.arc':

  ;; Uses all in 'a'
  (use* 'a)
  (myfun "hy!")
File 'd.arc':

  ;; Use 'a' as 'z'
  (useas 'z 'a)
  (z@myfun "ho!")
In Arc's repl:

  arc> (use 'a)
  t
  arc> a@spam
  1
  arc> (set a@spam 5)
  5
  arc> (use 'a)
  t
  arc> a@spam
  5
  arc> (use 'd)
  ho!
  t
  arc> (use 'b)
  hi!
  t

-----