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
Attribute .= new initializers, Lock::Async identity, general T(x) coercion
Three general fixes surfaced while getting Cro::HTTP::Client's request pipeline to
compose under rakupp (`has Lock::Async $!lock .= new` and friends):
- `.= new` attribute initializers were silently DROPPED by the parser — only
`= EXPR` defaults were captured, so `has T $!x .= new` left `$!x` the bare type
object for every type. Parse `.= meth(args)` into a default of `$!x.meth(args)`,
and pre-seed each attr slot with its typed/zero default before evaluating the
default expression, so a self-referential `.= new` reads the type object as its
invocant. Plain `= EXPR` defaults are unchanged.
- Lock::Async now keeps its own type identity (so a `Lock::Async $!l` container
accepts `Lock::Async.new`, which previously came back typed `Lock` and failed
the container's type check) while sharing Lock's method implementations under
the cooperative GIL (.protect/.lock/.unlock).
- General `T(x)` type-coercion call: a known type used as a routine now coerces
its argument through the argument's `.T` method (Supply($chan) == $chan.Supply,
user-defined `.T` coercions), instead of "Undefined routine 'T'" for types
outside the Int/Str/... fast path.
Gate 194975 (+8), S17 unchanged at baseline, 0 regressions. Regression tests:
dot-equals-new-attr-default.raku, type-coercion-call.raku.
(Supply.Promise, needed to coerce `Promise(supply {…})`, is deferred: a naive
tapSupply-based impl double-fired `done` on an already-tapped live Supply and
regressed S17-supply/head.t. Cro's request still fails deeper — silently, at
connection setup — so it is not currently gated on Supply.Promise.)
if (isKind(Tok::Ident) || isKind(Tok::Var)) advance();
4647
4647
if (isKind(Tok::LParen)) { int d = 0; do { if (isKind(Tok::LParen)) d++; elseif (isKind(Tok::RParen)) d--; advance(); } while (d > 0 && !isKind(Tok::End)); }
0 commit comments