develooper Front page | perl.perl6.users | Postings from December 2018

so as a method: Is this expected or a bug?

Thread Next
From:
Richard Hainsworth
Date:
December 21, 2018 08:28
Subject:
so as a method: Is this expected or a bug?
Message ID:
6c1aa0f2-9174-7c65-f100-b8bf7a05ed9c@gmail.com
A snippet:

     my @a = 1..10;
     put +@a.so; # output 1
     put so(+@a); # output True
     put (+@a).so; # output True

This caught me because I used +@s.so when I tried to do something like:

     # in a class with 'has Bool $.pass;'
     return unless ( $!pass = +@a.so );
     # fails with a Type mismatch of Int being assigned to Bool

Is this an expected result, or a bug?


(I was going to ask this on StackOverflow, but it seems so like a bug 
that I decided to ask here first)

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About