Skip to content

0.28.0

Latest
Compare
Choose a tag to compare
@Kodiologist Kodiologist released this 05 Jan 15:06
· 82 commits to master since this release
eae2622

Removals

  • doc has been removed. Use (help (get-macro foo)) or (help (get-macro :reader foo)) instead.
  • delmacro has been removed. Use (eval-when-compile (del (get _hy_macros (hy.mangle "foo")))) instead.
  • hy.reserved has been removed. Use (.keys (builtins._hy_macros)) or Python's built-in keyword module instead.
  • The environment variables HY_DEBUG and HY_FILTER_INTERNAL_ERRORS have been replaced with HY_SHOW_INTERNAL_ERRORS.

Other Breaking Changes

  • defmacro and require can now define macros locally instead of only module-wide.
  • When a macro is require\d from another module, that module is no longer implicitly included when checking for further macros in the expansion.
  • hy.M has been renamed to hy.I.
  • hy.eval has been overhauled to be more like Python's eval. It also has a new parameter macros.
  • hy.macroexpand and hy.macroexpand-1 have been overhauled and generalized to include more of the features of hy.eval.
  • hy now only implicitly launches a REPL if standard input is a TTY.
  • hy -i has been overhauled to work as a flag like python3 -i.
  • hy2py now requires -m to specify modules, and uses the same sys.path rules as Python when parsing a module vs a standalone script.
  • New macro deftype.
  • New macro get-macro.
  • New macro local-macros.

New Features

  • New syntax (hy.R.aaa/bbb.m …) for calling the macro m from the module aaa.bbb without bringing m or aaa.bbb into scope.
  • nonlocal now also works for globally defined names.
  • defn, defn/a, and defclass now support type parameters.
  • HyReader now has an optional parameter to install existing reader macros from the calling module.
  • New pragma warn-on-core-shadow.

Misc. Improvements

  • Some syntax errors raised by core macros now have more informative messages.
  • Logical operators now compile to simpler Python code in some cases.

Bug Fixes

  • Implicit returns are now disabled in async generators.
  • Fixed parsing of infinite and NaN imaginary literals with an uppercase "J".
  • Double quotes inside of bracketed f-strings are now properly handled.
  • Fixed incomplete recognition of macro calls with a unary dotted head like ((. defn) f []).
  • ~@ #* now produces a syntax error instead of a nonsensical result.
  • nonlocal now works for top-level let-bound names.
  • require now warns when you shadow a core macro, like defmacro already did.
  • Fixed hy.eval failing on defreader or require forms that install a new reader.
  • The parameter result-ok that was mistakenly included in the signature of hy.macroexpand is now gone.
  • hy -i with a filename now skips shebang lines.