Nil is really a Failure that doesn't throw.  It indicates the absence of a 
value where there is one expected.

That is why Nil doesn't throw.  If you want to indicate a soft failure, you 
should use fail().

If the chain of methods you mention are core methods, and one of them is 
returning Nil, then perhaps we have a bug.  Could you elaborate on the 
situation where you encountered this?

> On 3 Dec 2020, at 15:22, Konrad Bucheli via perl6-users 
> <perl6-us...@perl.org> wrote:
> 
> 
> 
> On 02.12.20 15:55, Ralph Mellor wrote:
>> On Wed, Dec 2, 2020 at 7:08 AM Patrick R. Michaud <pmich...@pobox.com> wrote:
>>> Nil.any_non_existent method always seems to return Nil.  I'm not sure where 
>>> this is documented
>> It's near the top of the `Nil` doc page you linked:
>>> Any method call on `Nil` of a method that does not exist ... will succeed 
>>> and return `Nil`.
> 
> 
> OK, that is intentional and documented then. What is actually the rationale 
> for such a behaviour?
> 
> For me it was an unexpected trap as I had a chain of methods which should do 
> some side effect. It all went fine only the side effect was not there. I then 
> figured out after some time that one of methods returned Nil and somehow 
> silently it did not do what I expected.
> 
> Thanks
> 
> Konrad
> 

Reply via email to