Strange variable behaviour

2008-06-22 Thread Frederik Schwarzer
Hi,

there is something I do not understand.
I reduced the code to a minimal case.

If I do:
my $a = 23;
my $b = $a;   # copy
$a = 42;
say $b;   # 23
$b is 23,
and if I do:
my $a = 23;
my $b := $a;   # reference
$a = 42;
say $b;   # 42
$b is 42 because it is just a reference to $a.

But if I do:
my @arr = (23, 42);
my $temp = @arr[0];   # copy?
@arr[0] = @arr[1];
say $temp;   # 42
$temp is 42 ...
I expected $temp to be 23 here.

Am I missing something?

Regards,
Frederik


Re: Strange variable behaviour

2008-06-22 Thread Frederik Schwarzer
On Monday 23 June 2008 00:19:14 Moritz Lenz wrote:
> Will Coleda wrote:

Hi,


> > Which implementation of Perl 6 are you using here? In Rakudo,
> > everything works as you describe except for the last example which
> > dies on the last line with:

Erm, totally forgot that.
I am using a recent (read: hours) build of Parrot/Rakudo.
For testing I write small programmes and
execute them with "perl6 test.pl".

All the examples I gave compile just fine here.
I additionally have "use v6;" given at the beginning
of the file.


> In the non-interactive version it wroks as Frederik described, which is
> certainly a bug:
[...]
> Part of the problem is that it's not really tested because
> t/spec/S03-operators/assign.t can't be parsed by rakudo correctly, and
> the fudged version 1) exhibits GC bugs and 2) is mis-parsed by fudge and
> reports the number of tests wrongly.

Thank you for investigating. :)

Regards,
Frederik


Is rindex broken or does my brain need a reboot?

2012-05-07 Thread Frederik Schwarzer
Hi,

I had a little problem with rindex and wrote a small demo code that 
shows what I found.

The code is:
use v6;

my $string = "perl";
say $string;

  
say $string.WHAT;   

  
say $string.index("e"); 

  
say $string.rindex("e");

  


  
say ""; 

  
say @*ARGS[0];  

  
say @*ARGS[0].WHAT; 

  
say @*ARGS[0].index("e");   

  
say @*ARGS[0].rindex("e");  

  

When run, I see the following (with a two-week old build of Rakudo 
master):
$ perl6 index.pl perl
perl
Str()
1
1

perl
Str()
1
Failure.new(exception => X::AdHoc.new(payload => "substring not 
found"))

Do I miss something? Any help is appreciated.

Regards


Re: Is rindex broken or does my brain need a reboot?

2012-05-08 Thread Frederik Schwarzer
Am Dienstag, 8. Mai 2012, 15:28:12 schrieb Patrick R. Michaud:
> On Tue, May 08, 2012 at 01:02:24AM -0700, Stefan O'Rear wrote:
> > On Tue, May 08, 2012 at 05:19:40AM +0200, Frederik Schwarzer 
wrote:
> > > Hi,
> > > 
> > > I had a little problem with rindex and wrote a small demo code
> > > that shows what I found.
> > 
> > $ install/bin/perl6 -e 'say "perł".rindex("e");' perl
> > substring not found
> > 
> >   in method gist at src/gen/CORE.setting:8140
> >   in sub say at src/gen/CORE.setting:6244
> >   in block  at -e:1
> > 
> > $ install/bin/perl6 -v
> > This is perl6 version 2012.03-27-g5793035 built on parrot 4.2.0
> > revision RELEASE_4_2_0
> > 
> > 
> > rindex appears to not like utf-8 encoded strings very much.
> 
> Good catch!  Now reported as Parrot issue #767 and RT #112818.

Thanks Stefan for explaining the issue and Patick for taking the 
appropriate steps. :)

Regards


Happy Perlmas

2015-12-27 Thread Frederik Schwarzer
Congrats for reaching this milestone. :)

And thanks to all the contributors who kept going despite the ranting 
and who are practicing kindness towards trolls and ranters. 
Understanding that trolls can be transformed into users or 
contributors with a warm heart-felt hug is pure gold. :)

Keep it up!