Re: [perl #113886] Re: no ICU lib loaded - rakudo and parrot issue

2012-07-01 Thread Gabor Szabo
On Mon, Jul 2, 2012 at 9:08 AM, Patrick R. Michaud  wrote:
> This is now fixed in HEAD and will appear in the next release:

nice, thank you!

Gabor


Re: [perl #113886] Re: no ICU lib loaded - rakudo and parrot issue

2012-07-01 Thread Patrick R. Michaud
On Thu, Jun 28, 2012 at 08:24:31AM -0700, Patrick R. Michaud wrote:
> > Am 28.06.2012 14:31, schrieb Gabor Szabo:
> > >The following script generates an exception
> > >
> > >use v6;
> > >
> > >my %count;
> > >my $s = 'שלום';
> > >%count{$s} = 1;
> > >say $s;
> > >say %count.perl;
> > >
> > >no ICU lib loaded

This is now fixed in HEAD and will appear in the next release:

pmichaud@kiwi:~/p6/noicu$ ./perl6 -V | grep has_icu
parrot::has_icu=0
pmichaud@kiwi:~/p6/noicu$ cat rt113886.p6 
use v6;

my %count;
my $s = 'שלום';
%count{$s} = 1;
say $s;
say %count.perl;

pmichaud@kiwi:~/p6/noicu$ ./perl6 rt113886.p6 
שלום
("שלום" => 1).hash

Pm


[perl #113886] Re: no ICU lib loaded - rakudo and parrot issue

2012-06-28 Thread via RT
# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #113886]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org:443/rt3/Ticket/Display.html?id=113886 >


On Thu, Jun 28, 2012 at 02:40:40PM +0200, Moritz Lenz wrote:
> Am 28.06.2012 14:31, schrieb Gabor Szabo:
> >The following script generates an exception
> >
> >use v6;
> >
> >my %count;
> >my $s = 'שלום';
> >%count{$s} = 1;
> >say $s;
> >say %count.perl;
> >
> >no ICU lib loaded
> >  in method perl at src/gen/CORE.setting:3892
> >   in method perl at src/gen/CORE.setting:5921
> >   in method perl at src/gen/CORE.setting:6115
> >   in block  at code/count.pl6:7
> >
> >The crash is in calling .perl on the hash I think, printing the scalar 
> >worked.
>
> The difference is that á fits into Latin-1, and there's some support
> for characters in the Latin-1 range hardcoded into parrot/nqp/rakudo
> (dunno which part exactly) which works even in the absence of ICU.

It appears to be Str.perl that is the issue (Hash.perl ends up
calling Str.perl for the keys):

pmichaud@kiwi:~/p6/noicu$ cat x
my $s = 'שלום';
say $s;
say $s.perl;

pmichaud@kiwi:~/p6/noicu$ ./perl6 x
שלום
no ICU lib loaded
  in method perl at src/gen/CORE.setting:3892
  in block  at x:3

Str.perl tries to convert non-printing characters to \x[...]
escapes, and for characters outside of Latin-1 it needs ICU
in order to make that determination.  

We could have Str.perl do something more reasonable than 
throw the exception if ICU isn't present.

I'm filing a ticket for this to track it (even if we
ultimately decide to leave it as-is for a while).

Pm