github hylang/hy 1.0a2

latest releases: 0.24.0, 1.0a4, 1.0a3...
3 years ago

Removals

  • All reimplementations of functions in the package Toolz have been removed. Import these from Toolz (or CyToolz) instead. Beware that the Toolz functions are not all drop-in replacements for the old Hy functions; e.g., partition has a different order of parameters.

    • complement, compose (formerly comp in Hy), drop, first, identity, interleave, interpose, iterate, juxt, last, merge-with, nth, partition, second, take-nth, take
  • All aliases of objects in Python's standard library have been removed. Import these objects explicitly instead.

    • From itertools: accumulate, chain, combinations-with-replacement (formerly multicombinations in Hy), combinations, compress, count, cycle, dropwhile (formerly drop-while), filterfalse (formerly remove), groupby (formerly group-by), islice, permutations, product, repeat, starmap (formerly *map), takewhile (formerly take-while), tee, zip-longest
    • From functools: reduce
    • From fractions: Fraction (formerly fraction)
  • The following core predicate functions have been removed. Use isinstance etc. instead.

    • empty?, even?, every?, float?, integer-char?, integer?, iterable?, iterator?, keyword?, list?, neg?, none?, numeric?, odd?, pos?, some, string?, symbol?, tuple?, zero?
  • Several other core functions and macros have been removed:

    • keyword: Use (hy.models.Keyword (hy.unmangle …)) instead.
    • repeatedly: Use toolz.iterate instead.
    • if-not: Use (if (not …) …) instead.
    • lif-not: Use (lif (not …) …) instead.
    • macro-error: Use raise instead.
    • calling-module: Now internal to Hy.
    • calling-module-name: Now internal to Hy.

Other Breaking Changes

  • if no longer allows more than three arguments. Use cond instead.

  • cut with exactly two arguments (the object to be cut and the index) now works like Python slicing syntax and the slice function: (cut x n) gets the first n elements instead of everything after the first n.

  • In defn, the return-value annotation, if any, is now placed before the function name instead of after.

  • Python reserved words are no longer allowed as parameter names, nor as keywords in keyword function calls.

  • Hy model objects are no longer equal to ordinary Python values. For example, (!= 1 '1). You can promote values to models with hy.as-model before making such a check.

  • The following functions are now called as attributes of the hy module:

    • hy.disassemble, hy.gensym, hy.macroexpand, hy.macroexpand-1, hy.repr (formerly hy.contrib.hy-repr.hy-repr), hy.repr-register (formerly hy.contrib.hy-repr.hy-repr-register)
  • cmp has been renamed to chainc.

  • defclass no longer automatically adds None to the end of __init__ method definitions.

  • All special forms have been replaced with macros. This won't affect most preexisting code, but it does mean that user-defined macros can now shadow names like setv.

  • hy.repr no longer uses the registered method of a supertype.

  • The constructors of Symbol and Keyword now check that the input would be syntactically legal.

  • Attempting to call a core macro not implemented on the current version of Python is now an error.

  • hy.extra.reserved.special has been replaced with hy.extra.reserved.macros.

New Features

  • hy-repr is now the default REPL output function.
  • The command python -m hy now works the same as hy.
  • New function hy.as-model.
  • New macro match (Python 3.10 only).
  • annotate is now a user-visible macro.

Bug Fixes

  • Fixed issues with newer prereleases of Python 3.10.
  • The REPL now properly displays SyntaxErrors.
  • Fixed a bug in pprint in which width was ignored.
  • Corrected repr and hy.repr for f-strings.
  • --spy and --repl-output-fn can now overwrite HYSTARTUP values.

Don't miss a new hy release

NewReleases is sending notifications on new releases.