1.0a4
Removals
- Python 3.6 is no longer supported.
Other Breaking Changes
-
import
andrequire
no longer need outer brackets.(import [foo [bar]])
is now(import foo [bar])
and(import [foo :as baz])
is now(import foo :as baz)
. To import all names from a module, use(import foo *)
. -
Lots of objects (listed below) have been spun off to a new package called Hyrule, from which you can
import
orrequire
them. Thus Hy now brings only thehy
module and a limited set of core macros into scope automatically.- Functions:
butlast
,coll?
,constantly
,dec
,destructure
,distinct
,drop-last
,end-sequence
,flatten
,inc
,macroexpand-all
,parse-args
,pformat
,postwalk
,pp
,pprint
,prewalk
,readable?
,recursive?
,rest
,saferepr
,walk
- Classes:
PrettyPrinter
,Sequence
- Macros:
#%
,#:
,->
,->>
,ap-dotimes
,ap-each
,ap-each-while
,ap-filter
,ap-first
,ap-if
,ap-last
,ap-map
,ap-map-when
,ap-reduce
,ap-reject
,as->
,assoc
,cfor
,comment
,defmacro!
,defmacro/g!
,defmain
,defn+
,defn/a+
,defseq
,dict=:
,do-n
,doto
,fn+
,fn/a+
,ifp
,let+
,lif
,list-n
,loop
,ncut
,of
,profile/calls
,profile/cpu
,seq
,setv+
,smacrolet
,unless
,with-gensyms
- Functions:
-
Functions that provide first-class Python operators, such as
+
in constructs like(reduce + xs)
, are no longer brought into scope automatically. Say(import hy.pyops *)
to get them. -
Hy scoping rules more closely follow Python scoping in certain edge cases.
-
let
is now a core macro with somewhat different semantics. In particular, definition-like core macros (defn
,defclass
,import
) now introduce new names that shadow correspondinglet
-bound names and persist outside the body of thelet
. -
The constructors of
String
andFString
now check that the input would be syntactically legal as a literal. -
hy.extra.reserved
has been renamed tohy.reserved
.
New Features
hy.repr
now supports several more standard types.- The attribute access macro
.
now allows method calls. For example,(. x (f a))
is equivalent to(x.f a)
. hy.as-model
checks for self-references in its argument.- New function
hy.model_patterns.keepsym
.
Bug Fixes
- In comprehension forms other than
for
, assignments (other than:setv
and loop clauses) are now always visible in the surrounding scope. match
now only evaluates the subject once.let
will no longer re-evaluate the default arguments of a
function it's used in.hy.repr
now properly formats bracket strings.- The
repr
andstr
of string models now includebrackets
if necessary. - When standard output can't accommodate Unicode,
hy2py
now crashes instead of emitting incorrect Python code. - Fixed a bug with self-requiring files on Windows.
- Improved error messages for illegal uses of
finally
andelse
.