Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 6127 days ago | link | parent

  (from "some-idiot-made-a-long-named-module.arc")
  [fn]  (some-idiot-made-a-long-named-module@foo test)
   Demonstrates how having to mention the module everywhere
      just makes it harder for everyone.  Accepts two symbols,
      some-idiot-made-a-long-named-module@foo2 or
      some-idiot-made-a-long-named-module@foo3
      Example:
          (some-idiot-made-a-long-named-module@foo1
            'some-idiot-made-a-long-named-module@foo2)
      See also [[some-idiot-made-a-long-named-module@foo2]]
      [[some-idiot-made-a-long-named-module@foo3]]
There's a reason why package systems such as, say, C++'s, have some feature which allows you to not mention the module name all the time.


2 points by pau 6127 days ago | link

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 6127 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 6126 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

-----