Re: Detecting side-effects in Perl 6 (Was: Re: infectious traits and pure functions)

2009-02-18 Thread Moritz Lenz
TSa wrote: HaloO, Daniel Ruoso wrote: Em Ter, 2009-02-17 às 09:19 -0300, Daniel Ruoso escreveu: multi infix:+ (int where { 2 } $i, int where { 2 } $j) {...} As masak++ and moritz++ pointed out, this should be written multi infix:+ (int $i where 2, int $j where 2) {...} Hmm, both

Re: Detecting side-effects in Perl 6 (Was: Re: infectious traits and pure functions)

2009-02-17 Thread Daniel Ruoso
Em Ter, 2009-02-17 às 09:19 -0300, Daniel Ruoso escreveu: multi infix:+ (int where { 2 } $i, int where { 2 } $j) {...} As masak++ and moritz++ pointed out, this should be written multi infix:+ (int $i where 2, int $j where 2) {...} daniel

Re: Detecting side-effects in Perl 6 (Was: Re: infectious traits and pure functions)

2009-02-17 Thread TSa
HaloO, Daniel Ruoso wrote: The problem is that you can't really know wether a value is immutable or not, we presume a literal 1 to be immutable, but even if you receive :(Int $i), it doesn't mean $i is immutable, because that signature only checks if $i ~~ Int, which actually results in

Re: Detecting side-effects in Perl 6 (Was: Re: infectious traits and pure functions)

2009-02-17 Thread TSa
HaloO, Daniel Ruoso wrote: Em Ter, 2009-02-17 às 09:19 -0300, Daniel Ruoso escreveu: multi infix:+ (int where { 2 } $i, int where { 2 } $j) {...} As masak++ and moritz++ pointed out, this should be written multi infix:+ (int $i where 2, int $j where 2) {...} Hmm, both these forms strike

Re: Detecting side-effects in Perl 6 (Was: Re: infectious traits and pure functions)

2009-02-17 Thread Darren Duncan
TSa wrote: Daniel Ruoso wrote: The problem is that you can't really know wether a value is immutable or not, we presume a literal 1 to be immutable, but even if you receive :(Int $i), it doesn't mean $i is immutable, because that signature only checks if $i ~~ Int, which actually results in

Re: Detecting side-effects in Perl 6 (Was: Re: infectious traits and pure functions)

2009-02-17 Thread Martin D Kealey
On Tue, 17 Feb 2009, TSa wrote: I fully agree that immutability is not a property of types in a signature. But a signature should have a purity lock :(Int $i is pure) that snapshots an object state [...] Note that this purity lock doesn't lock the outer object. It is only affecting the inner

Re: Detecting side-effects in Perl 6 (Was: Re: infectious traits and pure functions)

2009-02-17 Thread Darren Duncan
Something that may possibly be relevant to this discussion as an object lesson ... In the near future, probably next week, I'm going to re-implement the guts of my Set::Relation module (for Perl 5, on CPAN now), from an eagerly evaluated sometimes mutable or immutable object, to a