Re: a necessary no-op

2018-10-29 Thread Brandon Allbery
What jumps out to me is the difference between a normal method and a metamethod; the latter might not do sufficient validation, so you're catching the exception from trying to invoke .gist. And that just happens to do the right thing in your case; if you're getting a VMNull from an implementation-i

a necessary no-op

2018-10-29 Thread Joseph Brenner
I've got a weird one here... a line that looks like it does nothing significant is needed for the code to work. If the line below marked "The Mystery Line" is commented out, you just get the error: ===SORRY!=== Cannot look up attributes in a VMNull type object Augment::Util: class Recompos

Re: Exception Handling, DivideByZero

2018-10-29 Thread Brad Gilbert
.WHAT gives you the actual type, whereas .^name gives you a string that is the name. In Perl6 types are things you can pass around; which is good because you can have more than one with the same name. sub bar (){ my class Foo { } } sub baz (){ my class Foo { } }

Re: Exception Handling, DivideByZero

2018-10-29 Thread Joseph Brenner
Brandon Allbery wrote: > Two issues: > > (1) all standard exceptions are in or under the X:: namespace. > > (2) .WHAT doesn't show names with their namespaces, whereas .^name does. > > pyanfar Z$ 6 'my $r = 4/0; say $r; CATCH {default {say .^name}}' > X::Numeric::DivideByZero Thanks. I didn't ge

Re: Exception Handling, DivideByZero

2018-10-29 Thread Brandon Allbery
Two issues: (1) all standard exceptions are in or under the X:: namespace. (2) .WHAT doesn't show names with their namespaces, whereas .^name does. pyanfar Z$ 6 'my $r = 4/0; say $r; CATCH {default {say .^name}}' X::Numeric::DivideByZero On Mon, Oct 29, 2018 at 1:04 PM Joseph Brenner wrote:

Exception Handling, DivideByZero

2018-10-29 Thread Joseph Brenner
I was just looking into doing some finer-grained exception handling, so I tried this: use v6; try { my $result = 4/0; say "result: $result"; CATCH { #when DivideByZero { say "Oh, you know."; } default { say .WHAT; .Str.say } # (DivideByZero) Attem