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

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

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



Subject: [NYI] PRE submethods in a class don't check instance preconditions in Rakudo
From: Carl Mäsak <cmasak [...] gmail.com>
Date: Sun, 31 Aug 2014 06:18:22 +0200
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 443b
<masak> m: class IncList { has @.values; submethod PRE { @!values eqv @!values.sort } }; say IncList.new(:values(1, 5, 3)) <camelia> rakudo-moar 5f9cd5: OUTPUT«IncList.new(values => Array.new(1, 5, 3))␤» * masak submits NYI rakudobug <masak> m: say [1, 5, 3] eqv [1, 5, 3].sort <camelia> rakudo-moar 5f9cd5: OUTPUT«False␤» My expectation is that, since the condition is False, the object would fail the precondition at creation time.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 807b
On Sat Aug 30 21:18:35 2014, masak wrote: Show quoted text
> <masak> m: class IncList { has @.values; submethod PRE { @!values eqv > @!values.sort } }; say IncList.new(:values(1, 5, 3)) > <camelia> rakudo-moar 5f9cd5: OUTPUT«IncList.new(values => > Array.new(1, 5, 3))␤» > * masak submits NYI rakudobug > <masak> m: say [1, 5, 3] eqv [1, 5, 3].sort > <camelia> rakudo-moar 5f9cd5: OUTPUT«False␤» > > My expectation is that, since the condition is False, the object would > fail the precondition at creation time.
Support for PRE and POST submethods is deferred until 6.d or later. All uppercase names are semi-reserved anyway, so it won't really be a backwards compatibility issue to add this functionality later, and while it's nice to have, there's not huge demand for it. Thus, removing it from the xmas list.


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