# New Ticket Created by Zefram
# Please include the string: [perl #128844]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=128844 >
> my $a = 3
3
> my $b = $a.VAR
3
> $b.WHAT.say
(Scalar)
> $a.abs
3
> $b.abs
Method 'abs' not
Patrick R. Michaud wrote:
>"store in a data structure" --> "bind using :="
That's not going to pass well through anything that treats the data
as values. For example, after your
>> my @c; @c[2] := $a; $a = 5; say @c[2];
>5
if I then do
my @d = @c.map({ $_ })
then @d[2] is not an
On Thu, Aug 04, 2016 at 09:54:54PM +0100, Zefram wrote:
> Patrick R. Michaud wrote:
> >So are you looking for...?
>
> No. I want a writable reference that I can pass around as a value,
> store in a data structure, and so on. The Scalar object obtained by
> "$a.VAR" is clearly the thing to pass
Patrick R. Michaud wrote:
>So are you looking for...?
No. I want a writable reference that I can pass around as a value,
store in a data structure, and so on. The Scalar object obtained by
"$a.VAR" is clearly the thing to pass around as a value; I'm looking
for the way to write through it.
On Thu, Aug 04, 2016 at 09:36:18PM +0100, Zefram wrote:
> Yeah. Let me try to make it clearer. In the above situation, with
> a reference to $a's Scalar container in $b, I'd like to achieve what
> the assignment "$a = 5" would, but by an operation using $b and not
> directly mentioning $a. The
Timo Paulssen via RT wrote:
>Well, assignment is implemented by calling .STORE on the scalar.
That's not usable in the way I'd expect:
> my $a = 3
3
> my $b = $a.VAR
3
> $b.STORE(5)
Cannot modify an immutable Int
in block at line 1
>The assignment operator is the operator to store into a
On 08/04/2016 08:47 PM, Zefram wrote:
> Timo Paulssen via RT wrote:
>> You can only assign to a Scalar.
> How? Specifically, in the situation where I have a Scalar as a value,
> stored in a variable or as a sub parameter. How do I assign into it?
> The usual assignment operator, if applied to
Timo Paulssen via RT wrote:
>You can only assign to a Scalar.
How? Specifically, in the situation where I have a Scalar as a value,
stored in a variable or as a sub parameter. How do I assign into it?
The usual assignment operator, if applied to the variable or parameter,
assigns to that
On 08/04/2016 08:31 PM, Zefram wrote:
> Timo Paulssen via RT wrote:
>> Aye, you can .<> the value to "decont" it,
> Doesn't work as an lvalue:
That should be very obvious; I may have communicated
less-than-effectively. You can only assign to a Scalar. You just used
.<> to get rid of the Scalar
On 04/08/16 20:09, Zefram wrote:> Is there some way I missed to get
access to the content of a Scalar? > Something other than exploiting
this bug? That's what I was > originally after when I ran into this. >
> -zefram
Aye, you can .<> the value to "decont" it, which will give you the
Timo Paulssen via RT wrote:
>However, in one of your examples you're actually getting a Scalar inside
>a Scalar. Check this out:
Huh, there is indeed a difference there that I wasn't aware of. Thanks.
Can also be seen by:
> sub tt0(Scalar $s) { say $s.WHAT; }
sub tt0 (Scalar $s) {
The := operator only has one behaviour/semantics in this example.
However, in one of your examples you're actually getting a Scalar inside
a Scalar. Check this out:
timo@schmand ~> perl6 -e 'my $a = 3; sub ss1(Scalar $s, $nv) { say
$s.VAR.DUMP }; ss1($a.VAR, 7)'
▶3
timo@schmand ~> perl6 -e
# New Ticket Created by Zefram
# Please include the string: [perl #128842]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=128842 >
> sub ss0(Scalar $s, $nv) { my $v := $s; $v = $nv }
sub ss0 (Scalar $s, $nv) {
Fixed with 02fdcf9 , tests needed
> On 04 Aug 2016, at 16:19, Aleks-Daniel Jakimenko-Aleksejev (via RT)
> wrote:
>
> # New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
> # Please include the string: [perl #128840]
> # in the subject line of all future
# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
# Please include the string: [perl #128840]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=128840 >
Code:
dd ‘-a’.IO.absolute
Output:
""
Obviously, that's not how it
15 matches
Mail list logo