You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of this writing, the latest released macropy3 (1.1.0b2) does not seem to run on Python 3.8 at all, so this migration just became top priority for the future development of unpythonic.
Drop Python 3.4 and 3.5 support, mcpyrate runs on 3.6+.
Add support for Python 3.8 and 3.9.
Drop macropy3 bootstrapper. The solution is to use macropython from mcpyrate instead.
Remove most mentions of pydialect; this technology is now part of mcpyrate.
Raise exception normally instead of assert when an error occurs during macro expansion (custom macro-related syntax errors, mostly).
Change macro interface call signatures to mcpyrate format.
Recurse explicitly in the syntax transformers.
The code to pass in the expander argument via dyn, so that the syntax transformer can expander.visit(tree), is already in place in the macro interfaces.
Convert MacroPy Walkers into mcpyrate AST walkers.
Port the scope analyzer.
expose_unhygienic does not exist in mcpyrate. Store dbgprint_expr in dyn.
Update quasiquote code, especially parts using hygienic quasiquotes (mcpyrate's work slightly differently).
Implement lazy, which was previously provided by MacroPy.
Implement the f[] macro of quick_lambda, which was previously provided by MacroPy.
Update quicklambda documentation to match new implementation.
@macro_stub does not exist in mcpyrate. Make a regular macro that raises SyntaxError.
Make some magic variables (such as anaphoric if's it), that error out at compile time when the name appears outside a meaningful context.
the in the testingtools module
call_cc in continuations
local, delete in do
it in aif
block and expr in let_syntax/abbrev
q, u, kw in prefix
block and expr in let_syntax/abbrev: for syntactic consistency, would be nice to pass their arguments using brackets. These are not actually macros, but AST patterns matched by let_syntax/abbrev itself...
mcpyrate does not auto-expand macros in quasiquoted code. Consider when we should do so, and when let the expander iterate on its own. (We don't emit many macro invocations; the ones we do, should be correct.)
If macros need to invoke other macros in their output, use hygienic macro capture in the quasiquoted code.
Investigate: do we still need to set ctx in our macros?
No, but we need to call mcpyrate.astfixers.fix_ctx when it is critical for the operation of some macro that the ctx are filled in correctly. Eliminated manual ctx filling and added those calls where needed.
Update macro docs: first pass → outside in and second pass → inside out. mcpyrate doesn't use a two-pass system, but performs outside-in iteration on each statement in the module until no macros remain; inside-out expansion must be explicitly asked for (by recursing explicitly).
Grep for any other interface changes for 0.15 I've forgotten about. Maybe move some of these to 0.16.
Replace obsolete function calls:
gen_sym switched to mcpyrate.gensym
unpythonic.syntax.util.splice removed and switched to mcpyrate.splicing.splice_expression
macropy.tracing.show_expanded switched to mcpyrate.debug.step_expansion
Grep for any remaining mentions of MacroPy.
Ones of historical interest left in; ones of current interest changed to point to mcpyrate.
Update setup.py.
Update contribution guidelines.
Items postponed until later:
Consider moving isx and getname from unpythonic.syntax.nameutil into mcpyrate.
This is hardly the only project that needs to detect names and/or values of hygienic captures in the AST, so beside the low-level workhorse to get the actual data (mcpyrate.quotes.is_captured_value), maybe mcpyrate should present a friendly high-level interface, too.
Now there's also is_unexpanded_expr_macro and is_unexpanded_block_macro. This is starting to look like the beginnings of a macro destructuring subsystem...
Also, consider making a simple AST pattern-matching utility; this would simplify AST analysis in macros.
This stuff is important, but not for 0.15. Moving for later.
Consider renaming 0.15 as 1.0.0.
Semantically, it's definitely 1.0, but the up-and-coming version has been known as "0.15" for such a long time (since 2019, maybe?) that maybe the number shouldn't be changed at this point.
Decided: not changing the version at this time. Maybe "0.16" could be 1.0.
Remaining items have been documented in the TODO comments at the start of the module unpythonic.syntax.__init__. It's a living development note that might not exactly match this occasionally updated one here in the issue comments.
Activity
Technologicat commentedon Dec 1, 2020
mcpyrateis now on PyPI.Technologicat commentedon Apr 12, 2021
Two steps:
mcpyratewith minimal changes. (To be done in 0.15.0.)mcpyrate. (To be done later, possibly in 0.15.x or in 0.16.0.)Technologicat commentedon Apr 13, 2021
As of this writing, the latest released
macropy3(1.1.0b2) does not seem to run on Python 3.8 at all, so this migration just became top priority for the future development ofunpythonic.Technologicat commentedon Apr 21, 2021
Status (❌ = no, ✅ = yes):
✅ Boots up on Python 3.8 and
mcpyrate✅ Passes test suite on Python 3.8 and
mcpyrate✅ Final touches for initial version running on
mcpyrateAs of ab9c836, done so far:
mcpyrateruns on 3.6+.macropy3bootstrapper. The solution is to usemacropythonfrommcpyrateinstead.pydialect; this technology is now part ofmcpyrate.assertwhen an error occurs during macro expansion (custom macro-related syntax errors, mostly).mcpyrateformat.expanderargument viadyn, so that the syntax transformer canexpander.visit(tree), is already in place in the macro interfaces.Walkers intomcpyrateAST walkers.expose_unhygienicdoes not exist inmcpyrate. Storedbgprint_exprindyn.mcpyrate's work slightly differently).lazy, which was previously provided by MacroPy.f[]macro ofquick_lambda, which was previously provided by MacroPy.quicklambdadocumentation to match new implementation.@macro_stubdoes not exist inmcpyrate. Make a regular macro that raisesSyntaxError.it), that error out at compile time when the name appears outside a meaningful context.thein thetestingtoolsmodulecall_ccincontinuationslocal,deleteindoitinaifblockandexprinlet_syntax/abbrevq,u,kwinprefixblockandexprinlet_syntax/abbrev: for syntactic consistency, would be nice to pass their arguments using brackets. These are not actually macros, but AST patterns matched bylet_syntax/abbrevitself...mcpyratedoes not auto-expand macros in quasiquoted code. Consider when we should do so, and when let the expander iterate on its own. (We don't emit many macro invocations; the ones we do, should be correct.)ctxin our macros?mcpyrate.astfixers.fix_ctxwhen it is critical for the operation of some macro that thectxare filled in correctly. Eliminated manualctxfilling and added those calls where needed.mcpyratedoesn't use a two-pass system, but performs outside-in iteration on each statement in the module until no macros remain; inside-out expansion must be explicitly asked for (by recursing explicitly).gen_symswitched tomcpyrate.gensymunpythonic.syntax.util.spliceremoved and switched tomcpyrate.splicing.splice_expressionmacropy.tracing.show_expandedswitched tomcpyrate.debug.step_expansionmcpyrate.setup.py.Items postponed until later:
Consider movingisxandgetnamefromunpythonic.syntax.nameutilintomcpyrate.mcpyrate.quotes.is_captured_value), maybemcpyrateshould present a friendly high-level interface, too.is_unexpanded_expr_macroandis_unexpanded_block_macro. This is starting to look like the beginnings of a macro destructuring subsystem...Consider renaming 0.15 as 1.0.0.Remaining items have been documented in the TODO comments at the start of the module
unpythonic.syntax.__init__. It's a living development note that might not exactly match this occasionally updated one here in the issue comments.Technologicat commentedon May 8, 2021
As of ab9c836, we're "done enough" for a first version that runs on
mcpyrateand Python 3.6 through 3.9.