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
e.g. (using the currently-invalid brace syntax from #11892)
macro_rules! spawn {($b: block_internals) => {spawn(proc(){ $b })}}spawn!{use foo::bar;fn baz(){}if x ==0{ bar()}let a =1+2;
foo();
baz()}
I don't believe this is currently possible to emulate. e.g. with $($s: stmt);* you have to write fn foo() {}; if x == 0 { bar() }; ... and without the ; you end up with foo() bar() being valid (and expr doesn't allow for statements like let and fn bar() {}). The best solution I've found is just writing ($e: expr) => { ... } but this requires double braces:
spawn!{ foo()}// okspawn!{foo(); bar()}// not ok! :(spawn!{{foo(); bar()}}// ok :(
This would make sugary control-flow-y macros like spawn and scope/finally from #11905 more natural.
The text was updated successfully, but these errors were encountered:
but that's pretty ugly, because tt's can only be passed to macro invocations, so we need the silly no-op expr macro to allow us to interpolate the $body tokens (#5846).
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.
e.g. (using the currently-invalid brace syntax from #11892)
I don't believe this is currently possible to emulate. e.g. with
$($s: stmt);*
you have to writefn foo() {}; if x == 0 { bar() }; ...
and without the;
you end up withfoo() bar()
being valid (andexpr
doesn't allow for statements likelet
andfn bar() {}
). The best solution I've found is just writing($e: expr) => { ... }
but this requires double braces:This would make sugary control-flow-y macros like
spawn
andscope
/finally
from #11905 more natural.The text was updated successfully, but these errors were encountered: