hy/hy
Kodi Arfer 14fddbe6c3 Give require the same features as import (#1142)
Give `require` the same features as `import`

You can now do (require foo), (require [foo [a b c]]), (require [foo [*]]), and (require [foo :as bar]). The first and last forms get you macros named foo.a, foo.b, etc. or bar.a, bar.b, etc., respectively. The second form only gets the macros in the list.

Implements #1118 and perhaps partly addresses #277.

N.B. The new meaning of (require foo) will cause all existing code that uses macros to break. Simply replace these forms with (require [foo [*]]) to get your code working again.

There's a bit of a hack involved in the forms (require foo) or (require [foo :as bar]). When you call (foo.a ...) or (bar.a ...), Hy doesn't actually look inside modules. Instead, these (require ...) forms give the macros names that have periods in them, which happens to work fine with the way Hy finds and interprets macro calls.

* Make `require` syntax stricter and add tests

* Update documentation for `require`

* Documentation wording improvements

* Allow :as in `require` name lists
2016-11-03 09:35:58 +02:00
..
contrib Give require the same features as import (#1142) 2016-11-03 09:35:58 +02:00
core Merge branch 'master' into pr/1048 2016-10-20 19:19:21 +03:00
lex Teach apply about symbol mangling 2015-09-24 09:47:12 +02:00
models Don't sort or deduplicate the items in a HySet 2016-09-26 09:47:04 -07:00
__init__.py Generate hy.version using git describe 2016-10-12 17:11:44 -07:00
__main__.py Typo fixes in comments 2014-05-02 21:31:51 +05:30
_compat.py adds support for Python 3.5 infix matrix multiplication 2015-04-12 21:45:39 -07:00
cmdline.py Give require the same features as import (#1142) 2016-11-03 09:35:58 +02:00
compiler.py Give require the same features as import (#1142) 2016-11-03 09:35:58 +02:00
completer.py move imports and operators to satisfy new version of pep8 checker 2015-02-16 22:21:49 -08:00
errors.py Fix issue #982: UTF-8 encode error message before passing it to clint. 2015-12-14 21:55:53 +01:00
importer.py Add import_file_to_globals for use in emacs inferior lisp mode 2016-07-01 23:27:36 +01:00
macros.py Give require the same features as import (#1142) 2016-11-03 09:35:58 +02:00