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
Clearly we're manually wrapping a lot of these in the right Val type. How about we do that automatically once and for all somewhere, instead of in every single subroutine?
The easy way: define a wrap which does the right thing for the various Val types, and call it everywhere. Would still make things shorter.
The HOP way: define a wrap which takes a function that returns a Perl 6 value and returns a function that returns an appropriate Val value. Call it once from the loop that put-vars everything in the setting.
Oh, and I noticed two bugs while I was in there:
say => -> $arg { self.output.say(~$arg) },
type => sub ($arg) { return 'Sub' if $arg ~~ Val::Sub; $arg.^name.substr('Val::'.chars) },
type returns a Str, not a Val::Str. The HOP way mentioned above would make this implementation right without any further changes. say should proabably return None, but right now it is likely to return a Perl 6 Bool, because that's what $*OUT.say returns:
$ perl6 -e 'say (say "hi").^name'
hi
Bool
The text was updated successfully, but these errors were encountered:
I just caught sight of this in the setting code:
Clearly we're manually wrapping a lot of these in the right
Val
type. How about we do that automatically once and for all somewhere, instead of in every single subroutine?wrap
which does the right thing for the variousVal
types, and call it everywhere. Would still make things shorter.wrap
which takes a function that returns a Perl 6 value and returns a function that returns an appropriateVal
value. Call it once from the loop thatput-var
s everything in the setting.Oh, and I noticed two bugs while I was in there:
type
returns aStr
, not aVal::Str
. The HOP way mentioned above would make this implementation right without any further changes.say
should proabably returnNone
, but right now it is likely to return a Perl 6Bool
, because that's what$*OUT.say
returns:The text was updated successfully, but these errors were encountered: