Skip to content

Releases: Technologicat/unpythonic

Version 0.12.0

09 Jan 14:40
Compare
Choose a tag to compare

"Metamagical engineering" edition:

What does "metamagical" mean? To me, it means "going one level beyond magic". There is an ambiguity here: on the one hand, the word might mean "ultramagical" - magic of a higher order - yet on the other hand, the magical thing about magic is that what lies behind it is always nonmagical. That's metamagic for you!
--Douglas R. Hofstadter, On Self-Referential Sentences (essay, 1981)

New:

  • Alternative, haskelly let syntax let[((x, 2), (y, 3)) in x + y] and let[x + y, where((x, 2), (y, 3))]
    • Supported by all let forms: let, letseq, letrec, let_syntax, abbrev
  • When making just one binding, can now omit outer parentheses in let: let(x, 1)[...], let[(x, 1) in ...], let[..., where(x, 1)]
  • unpythonic.misc.Box: the classic rackety single-item mutable container
  • Many small improvements to documentation

Breaking changes:

  • New, perhaps more natural call_cc[] syntax for continuations, replaces earlier with bind[...]
    • Conditional continuation capture with call_cc[f() if p else None]
    • cc parameter now added implicitly, no need to declare explicitly unless actually needed (reduces visual noise in client code)
  • Local variables in a do are now declared using macro-expr syntax local[x << 42], looks more macropythonic
  • Silly (lambda) suffix removed from names of named lambdas (to detect them in client code, it's enough that isinstance(f, types.LambdaType))

Version 0.11.1

22 Nov 15:02
Compare
Choose a tag to compare

"Cleaning up, vol. 2" edition:

Enhancements:

  • Create a proper decorator registry for the syntax machinery.
    • Can now register priorities for custom decorators to tell the syntax system about their correct ordering (for sort_lambda_decorators, suggest_decorator_index).
    • Register priorities for (some of) unpythonic's own decorators using this new system, replacing the old hardcoded decorator registry.
    • Now lives in unpythonic.regutil; used only by the syntax subsystem, but doesn't require MacroPy just to start up.
  • Try to determine correct insertion index for trampolined and curry decorators in macros that insert them to decorator_list of FunctionDef nodes (using any already applied known decorators as placement hints, like a programmer would).
  • namedlambda: recognize also decorated lambdas, and calls to curry where the last argument is a lambda (useful for looped_over et al.).

Breaking change:

  • Remove the special jump target SELF.
    • Was always a hack; no longer needed now that v0.11.0 introduced the general solution: the withself function that allows a lambda to refer to itself anywhere, not just in a jump.
    • Now the whole thing is easier to explain, so likely a better idea (ZoP §17, 18).

Version 0.11.0

15 Nov 12:22
Compare
Choose a tag to compare

"Spring cleaning in winter" edition:

New:

  • Add @callwith: freeze arguments, choose function later
  • Add withself: allow a lambda to refer to itself
  • Add let_syntax: splice code at macro expansion time
  • Add quicklambda: block macro to combo our blocks with MacroPy's quick_lambda
  • Add debug option to MacroPy bootstrapper

Enhancements:

  • prefix macro now works together with let and do

Bugfixes:

  • detect TCO'd lambdas correctly (no longer confused by intervening FunctionDef nodes with TCO decorators)
  • scoping: detect also names bound by For, Import, Try, With

Breaking changes:

  • Rename dynscope --> dynassign; technically dynamic assignment, not scoping
  • Rename localdef --> local; shorter, more descriptive
  • scanr now returns results in the order computed (CAUTION: different from Haskell)
  • simple_let, simple_letseq --> let, letseq in unpythonic.syntax.simplelet
  • cons now prints pythonically by default, to allow eval; use .lispyrepr() to get the old output
  • Remove separate dynvar curry_toplevel_passthrough; expose curry_context instead

Other:

  • Reorganize source tree, tests now live inside the project
  • Pythonize runtests, no more bash script
  • Add countlines Python script to estimate project size

Version 0.10.4

29 Oct 10:02
Compare
Choose a tag to compare

"573 combo!" edition*:

  • new: macro wrappers for the let decorators
  • fix: trampolined() should go on the outside even if the client code manually uses curry()
  • enh: improve tco, fploop combo
  • enh: improve lexical scoping support

Version 0.10.3

25 Oct 11:30
Compare
Choose a tag to compare

"Small fixes" edition:

  • enh: curry macro now curries also definitions (def, lambda), not only calls
  • fix: spurious recomputation bug in do[]
  • update and fix READMEs and docstrings

Version 0.10.2

24 Oct 09:01
Compare
Choose a tag to compare

"Just a few more things" edition:

Bugfixes:

  • Arities:
    • Compute arities of methods correctly
    • Workaround for some builtins being uninspectable or reporting incorrect arities
  • Macros:
    • An implicit curry(f) should call f also if no args
    • Fix missing optional_vars in manually created withitem nodes

Version 0.10.1

23 Oct 19:40
Compare
Choose a tag to compare

"Just one more thing" edition:

  • continuations: create continuation using same node type (FunctionDef or AsyncFunctionDef) as its parent function
  • autoreturn: fix semantics of try block
  • fix docstring of tco

Version 0.10.0

23 Oct 12:49
Compare
Choose a tag to compare

"0.10.0 is more than 0.9.∞" edition:

  • Add more macros, notably continuations, tco, autoreturn
  • Polish macros, especially their interaction
  • Remove old exception-based TCO, rename fasttco to tco

Version 0.9.2

09 Oct 11:04
Compare
Choose a tag to compare

"Through the looking glass" edition:

  • new multilambda block macro: supercharge regular Python lambdas, contained lexically inside the block, with support for multiple expressions and local variables. Use brackets to denote a multi-expression body.
  • new fup macro providing more natural syntax for functional updates; allows using slice syntax.
  • upgrade: the let macros can now optionally have a multi-expression body. To enable, wrap the body in an extra set of brackets.
  • remove the 0.9.0 multilambda λ; brittle and was missing features.

The macros implement the multi-expression bodies by inserting a do; this introduces an internal-definition context for local variables. See its documentation in the macro_extras README for usage.

The macro_extras README now includes a table of contents for easy browsability.

Version 0.9.0

05 Oct 10:28
Compare
Choose a tag to compare

"Super Syntactic Fortress MACROS" edition:

  • Macros! New module unpythonic.syntax, adding syntactic macros for constructs where this improves usability. See macro_extras for documentation.
    • Notable macros include curry (automatic currying for Python) and cond (multi-branch conditional expression, usable in a lambda), and macro variants of the let constructs (no boilerplate).
    • As of this writing, requires the latest MacroPy3 from git HEAD.
    • Not loaded by default. To use, from unpythonic.syntax import macros, ....
  • Include generic MacroPy3 bootstrapper for convenience, to run macro-enabled Python programs.
  • Fix bug in let constructs: should require unique names in the same let/letrec.
  • Fix bug in unpythonic.fun.apply.