hy/tests/native_tests
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
__init__.hy ideas, ideas. 2013-03-05 18:39:34 -05:00
cons.hy Add a cons object and related mechanisms 2014-01-23 23:08:52 +01:00
core.hy Require Python 3 for neg? and pos? type tests 2016-10-11 20:14:14 -07:00
defclass.hy Drop a set of brackets from let. 2015-10-01 10:08:04 +02:00
language.hy Give require the same features as import (#1142) 2016-11-03 09:35:58 +02:00
mathematics.hy Make unary + call __pos__ 2016-09-20 13:05:52 -07:00
native_macros.hy Don't sort or deduplicate the items in a HySet 2016-09-26 09:47:04 -07:00
py3_only_tests.hy Drop a set of brackets from let. 2015-10-01 10:08:04 +02:00
quote.hy Remove HyLambdaListKeyword from the parser 2014-06-03 21:36:49 -04:00
reader_macros.hy defreader: Allow strings as macro names 2015-12-17 13:24:20 +01:00
shadow.hy Make unary + call __pos__ 2016-09-20 13:05:52 -07:00
unless.hy purged null from Hy 2015-08-11 16:22:13 -06:00
when.hy purged null from Hy 2015-08-11 16:22:13 -06:00
with_decorator.hy defclass reimagined 2015-08-04 16:43:07 +02:00
with_test.hy Drop a set of brackets from with. 2015-10-01 10:08:04 +02:00