Removals
- Dotted lists,
HyCons
,cons
,cons?
, andlist*
have been removed. These were redundant with Python's built-in data structures and Hy's most common model types (HyExpression
,HyList
, etc.). &key
is no longer special in lambda lists. Use&optional
instead.- Lambda lists can no longer unpack tuples.
ap-pipe
andap-compose
have been removed. Use threading macros andcomp
instead.for/a
has been removed. Use(for [:async ...] ...)
instead.(except)
is no longer allowed. Use(except [])
instead.(import [foo])
is no longer allowed. Use(import foo)
instead.
Other Breaking Changes
-
HyExpression
,HyDict
, andHySet
no longer inherit fromHyList
. This means you can no longer use alternative punctuation in place of square brackets in special forms (e.g.(fn (x) ...)
instead of the standard(fn [x] ...)
). -
Mangling rules have been overhauled; now, mangled names are always legal Python identifiers.
-
_
and-
are now equivalent, even as single-character names.- The REPL history variable
_
is now*1
.
- The REPL history variable
-
Non-shadow unary
=
,is
,<
, etc. now evaluate their argument instead of ignoring it. -
list-comp
,set-comp
,dict-comp
, andgenexpr
have been replaced bylfor
,sfor
,dfor
, andgfor
, respectively, which use a new syntax and have additional features. All Python comprehensions can now be written in Hy. -
&
-parameters in lambda lists must now appear in the same order that Python expects. -
Literal keywords now evaluate to themselves, and
HyKeyword
no longer inherits from a Python string type -
HySymbol
no longer inherits fromHyString
.
New Features
- Python 3.7 is now supported.
while
andfor
are allowed to have empty bodies.for
supports the various new clause types offered bylfor
.defclass
in Python 3 supports specifying metaclasses and other keyword arguments.- Added
mangle
andunmangle
as core functions. - Added more REPL history variables:
*2
and*3
. - Added a REPL variable holding the last exception:
*e
. - Added a command-line option
-E
per CPython. - Added a new module
hy.model_patterns
.
Bug Fixes
hy2py
should now output legal Python code equivalent to the input Hy code in all cases.- Fixed
(return)
so it can exit a Python 2 generator. - Fixed a case where
->
and->>
duplicated an argument. - Fixed bugs that caused
defclass
to drop statements or crash. - Fixed a REPL crash caused by illegal backslash escapes.
NaN
can no longer create an infinite loop during macro-expansion.- Fixed a bug that caused
try
to drop expressions. - The compiler now properly recognizes
unquote-splice
. - Trying to import a dotted name is now a syntax error, as in Python.
defmacro!
now allows optional arguments.- Fixed handling of variables that are bound multiple times in a single
let
.
Misc. Improvements
hy-repr
uses registered functions instead of methods.hy-repr
supports more standard types.