Thunking semantics of :=

2005-04-23 Thread Autrijus Tang
Greetings. In implementing :=, I have discovered two different set of semantics in explantations. I will refer them as "linking" and "thunking". The "linking" semantic is akin to hard links in filesystems. It takes the storage location in the RHS and binds its to the name in the LHS: $x := $

Re: Thunking semantics of :=

2005-04-23 Thread Ingo Blechschmidt
Hi, Autrijus Tang wrote: > my ($x, @a); > $x := @a[0]; > @a := ($x, $x, $x); > $x := 1; > say @a; # (undef, undef, undef) hm, I'd expect @a to be (1, 1, 1) (WE = when evaluated): my ($x, @a);# $x is undef WE, @a is () WE $x := @a[0];# $x is undef WE, @a is

Re: Thunking semantics of :=

2005-04-23 Thread Juerd
Autrijus Tang skribis 2005-04-23 18:51 (+0800): > Now, those two semantics directly clash when the RHS can be > interpreted both ways. Not if methods for attributes like .chars promise to always return the same variable, which would make even more sense if they were lvalue methods. They can be put

Re: Thunking semantics of :=

2005-04-23 Thread Larry Wall
On Sat, Apr 23, 2005 at 06:51:04PM +0800, Autrijus Tang wrote: : Greetings. In implementing :=, I have discovered two different : set of semantics in explantations. I will refer them as "linking" and : "thunking". Congratulations--you've rediscovered "call by ref" and "call by name", but computer

Re: Thunking semantics of :=

2005-04-23 Thread Autrijus Tang
On Sat, Apr 23, 2005 at 10:21:56AM -0700, Larry Wall wrote: > : Now, those two semantics directly clash when the RHS can be > : interpreted both ways. One good example would be array dereference: > : > : my ($x, @a); > : $x := @a[-1]; > : @a = (1..100); > : say $x; > : > : Under

Re: Thunking semantics of :=

2005-04-23 Thread Juerd
Autrijus Tang skribis 2005-04-24 3:47 (+0800): > $x := @a[0]; # vivified or not? Vivified, because you're taking a reference (not at language level) and you can't have a reference (at internal level) pointing to something that doesn't exist. At language level, you can, but only symbolica

Re: Thunking semantics of :=

2005-04-23 Thread Autrijus Tang
On Sat, Apr 23, 2005 at 09:50:26PM +0200, Juerd wrote: > Autrijus Tang skribis 2005-04-24 3:47 (+0800): > > $x := @a[0];# vivified or not? > > Vivified, because you're taking a reference (not at language level) and > you can't have a reference (at internal level) pointing to something > t

Re: Thunking semantics of :=

2005-04-23 Thread Juerd
Autrijus Tang skribis 2005-04-24 3:58 (+0800): > Please sanity-check the following: > pugs> my ($x, @a); $x := @a[-1]; $x = 3; @a > *** Error: Modification of non-creatable array value attempted Pass. (For reference: The error is in the second statement.) > pugs> my ($x, @a); $x := @

Re: Thunking semantics of :=

2005-04-23 Thread Larry Wall
On Sat, Apr 23, 2005 at 10:07:05PM +0200, Juerd wrote: : Autrijus Tang skribis 2005-04-24 3:58 (+0800): : > Please sanity-check the following: : > pugs> my ($x, @a); $x := @a[-1]; $x = 3; @a : > *** Error: Modification of non-creatable array value attempted : : Pass. (For reference: The e

Re: Thunking semantics of :=

2005-04-23 Thread Nigel Sandever
On Sun, 24 Apr 2005 03:47:42 +0800, [EMAIL PROTECTED] (Autrijus Tang) wrote: > > Oh well. At least the same code can be salvaged to make iThreads Please. No iThreads behaviour in Perl 6. Nobody uses them and whilst stable, the implementation is broken in so many way. But worse, the underlying

Re: Thunking semantics of :=

2005-04-23 Thread Larry Wall
On Sun, Apr 24, 2005 at 03:37:23AM +, Nigel Sandever wrote: : On Sun, 24 Apr 2005 03:47:42 +0800, [EMAIL PROTECTED] (Autrijus Tang) wrote: : > : > Oh well. At least the same code can be salvaged to make iThreads : : Please. No iThreads behaviour in Perl 6. : : Nobody uses them and whilst s

Re: Thunking semantics of :=

2005-04-24 Thread Nigel Sandever
On Sat, 23 Apr 2005 21:00:11 -0700, [EMAIL PROTECTED] (Larry Wall) wrote: > On Sun, Apr 24, 2005 at 03:37:23AM +, Nigel Sandever wrote: > : On Sun, 24 Apr 2005 03:47:42 +0800, [EMAIL PROTECTED] (Autrijus Tang) wrote: > : > > : > Oh well. At least the same code can be salvaged to make iThread

Re: Thunking semantics of :=

2005-04-24 Thread Aaron Sherman
On Sun, 2005-04-24 at 07:51 +, Nigel Sandever wrote: > On Sat, 23 Apr 2005 21:00:11 -0700, [EMAIL PROTECTED] (Larry Wall) wrote: > > From what I've read, the trend in most modern implementations of > > concurrency is away from shared state by default, essentially because > > shared memory simp