[perl #130493] [RFC][@LARRY] .sink of class not getting called, but Mu.sink is <[email protected]>
[email protected] ("Aleks-Daniel Jakimenko-Aleksejev via RT") Sat, 10 Mar 2018 11:33:15 -0800
| Newsgroups | perl.perl6.compiler |
|---|---|
| Message-ID | <[email protected]> |
I find the behavior surprising. Are there any examples of precedence thinkos that are caught by this? Added [RFC][@LARRY] tags, with just a little more information I think we'll be able to close. Maybe. On 2017-01-03 09:00:06, [email protected] wrote: > On Tue, 03 Jan 2017 04:54:52 -0800, elizabeth wrote: > > $ 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