3 ms·
sadly, it looks this still won't get us multi-line lambdas, because macro-expressions can only take other expressions as arguments :( (though the PEP wasn't re
by uryga 6y ago
sadly, it looks this still won't get us multi-line lambdas, because macro-expressions can only take other expressions as arguments :(
(though the PEP wasn't really clear on this. the grammar rule they give is:
macro_expr = MACRO_NAME "(" testlist ")"
but i wasn't able to find a definition for `testlist`.)
---
EDIT:
but taking inspiration from the PEP's reimplementations of python keywords, we could (maybe? kinda?) add macros for expression-oriented versions of statements, and just use those instead! really hope this gets accepted, can't wait to write some truly appalling macros >:D
---
EDIT 2:
also hey, at least it looks like it can handle do-notation!
x = do!(
a := foo(),
b := bar(),
pure(a + b)
)
i guess you could even use
a <= foo()
for binding. i'm sure everyone would love that ;)