Releases: Technologicat/unpythonic
Version 0.12.0
"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
syntaxlet[((x, 2), (y, 3)) in x + y]
andlet[x + y, where((x, 2), (y, 3))]
- Supported by all
let
forms:let
,letseq
,letrec
,let_syntax
,abbrev
- Supported by all
- 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 earlierwith 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)
- Conditional continuation capture with
- Local variables in a
do
are now declared using macro-expr syntaxlocal[x << 42]
, looks more macropythonic - Silly
(lambda)
suffix removed from names of named lambdas (to detect them in client code, it's enough thatisinstance(f, types.LambdaType)
)
Version 0.11.1
"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.
- Can now register priorities for custom decorators to tell the syntax system about their correct ordering (for
- Try to determine correct insertion index for
trampolined
andcurry
decorators in macros that insert them todecorator_list
ofFunctionDef
nodes (using any already applied known decorators as placement hints, like a programmer would). namedlambda
: recognize also decorated lambdas, and calls tocurry
where the last argument is a lambda (useful forlooped_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 ajump
. - Now the whole thing is easier to explain, so likely a better idea (ZoP §17, 18).
- Was always a hack; no longer needed now that v0.11.0 introduced the general solution: the
Version 0.11.0
"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
"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
"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
"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 callf
also if no args - Fix missing
optional_vars
in manually createdwithitem
nodes
- An implicit
Version 0.10.1
"Just one more thing" edition:
continuations
: create continuation using same node type (FunctionDef
orAsyncFunctionDef
) as its parent functionautoreturn
: fix semantics of try block- fix docstring of tco
Version 0.10.0
"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
totco
Version 0.9.2
"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
"Super Syntactic Fortress MACROS" edition:
- Macros! New module
unpythonic.syntax
, adding syntactic macros for constructs where this improves usability. Seemacro_extras
for documentation.- Notable macros include
curry
(automatic currying for Python) andcond
(multi-branch conditional expression, usable in a lambda), and macro variants of thelet
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, ...
.
- Notable macros include
- 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
.