Skip Menu |
Report information
Id: 130493
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: elizabeth <liz [at] dijkmat.nl>
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: .sink of class not getting called, but Mu.sink is
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
To: rakudobug [...] perl.org
Date: Tue, 3 Jan 2017 13:54:33 +0100
Download (untitled) / with headers
text/plain 522b
$ 6 'class A { method sink() { say "goodbye" } }; A’ WARNINGS for -e: Useless use of constant value A in sink context (line 1) I would expected this to say “goodbye” rather than being silent and issuing a warning. The fact that a class has a specific .sink method indicates that the developer had a plan for functioning in a sink environment. So it should a. call that method and b. not issue a warning. Adding an nqp::say(“sunk”) to Mu.sink reveals that in the above case Mu.sink *does* appear to be called.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 795b
On Tue, 03 Jan 2017 04:54:52 -0800, elizabeth wrote: Show quoted text
> $ 6 'class A { method sink() { say "goodbye" } }; A’ > WARNINGS for -e: > Useless use of constant value A in sink context (line 1) > > I would expected this to say “goodbye” rather than being silent and > issuing a warning. The fact that a class has a specific .sink method > indicates that the developer had a plan for functioning in a sink > environment. So it should a. call that method and b. not issue a > warning. >
I think we consciously decided that use of a type object in sink context would always warn (justification is that it's been known to catch the odd precedence thinko). Note that with an instance: $ perl6-m 'class A { method sink() { say "goodbye" } }; A.new' goodbye It does exactly what you expect. /jnthn


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org