github hylang/hy 1.0a4

latest release: 0.24.0
2 years ago

Removals

  • Python 3.6 is no longer supported.

Other Breaking Changes

  • import and require 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 or require them. Thus Hy now brings only the hy 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 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 corresponding let-bound names and persist outside the body of the let.

  • The constructors of String and FString now check that the input would be syntactically legal as a literal.

  • hy.extra.reserved has been renamed to hy.reserved.

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 and str of string models now include brackets 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 and else.

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.

Don't miss a new hy release

NewReleases is sending notifications on new releases.