Re: [perl #128154] [BUG] Cannot use qqx in rakudo star on windows7

2018-07-12 Thread Kamil Kułaga via RT
Will it work fine for utf-16 users?
On Wed, Jul 11, 2018 at 11:16 AM Steve Mynott via RT
 wrote:
>
> Maybe the Windows port of rakudo should set this automatically on startup?
> On Wed, 11 Jul 2018 at 10:08, Kamil Kułaga via RT
>  wrote:
> >
> > I found resolution. It looks like it is problem windows locale issue than 
> > perl itself.
> >
> > Running command
> >
> > chcp utf8
> >
> > Makes work just fine. Default is 852. I'm very supprised because I use 
> > unicode encoding all the the time and never had such issue. For me it would 
> > be better to detect if codepage is set to 852 and warn user that perl6 may 
> > not work well. Shall we close it or leave defect for future improvement?
>
>
>
> --
> Steve Mynott 
> cv25519/ECF8B611205B447E091246AF959E3D6197190DD5
>


-- 
Pozdrawiam

Kamil Kułaga


Re: [perl #128154] [BUG] Cannot use qqx in rakudo star on windows7

2018-07-12 Thread Kamil Kułaga
Will it work fine for utf-16 users?
On Wed, Jul 11, 2018 at 11:16 AM Steve Mynott via RT
 wrote:
>
> Maybe the Windows port of rakudo should set this automatically on startup?
> On Wed, 11 Jul 2018 at 10:08, Kamil Kułaga via RT
>  wrote:
> >
> > I found resolution. It looks like it is problem windows locale issue than 
> > perl itself.
> >
> > Running command
> >
> > chcp utf8
> >
> > Makes work just fine. Default is 852. I'm very supprised because I use 
> > unicode encoding all the the time and never had such issue. For me it would 
> > be better to detect if codepage is set to 852 and warn user that perl6 may 
> > not work well. Shall we close it or leave defect for future improvement?
>
>
>
> --
> Steve Mynott 
> cv25519/ECF8B611205B447E091246AF959E3D6197190DD5
>


-- 
Pozdrawiam

Kamil Kułaga


[perl #128154] [BUG] Cannot use qqx in rakudo star on windows7

2018-07-11 Thread Kamil Kułaga via RT
I found resolution. It looks like it is problem windows locale issue than perl 
itself.

Running command

chcp utf8

Makes work just fine. Default is 852. I'm very supprised because I use unicode 
encoding all the the time and never had such issue. For me it would be better 
to detect if codepage is set to 852 and warn user that perl6 may not work well. 
Shall we close it or leave defect for future improvement?


Re: [perl #122289] [BUG] unexpected behaviour during EVAL()

2017-12-04 Thread Kamil Kułaga via RT
Hi Aleks,

Thanks for reminder i totally forgot about this RT.

Looks like it was fine in 2015
https://github.com/teodozjan/lacuna-cookbuk/commit/f2ebae3efda06f35b1d679e17e14c259bd718b95#diff-73e69e63f060cafc548379f4dcc52105
shall i test it to be 100% sure or you want to close it?

On Sun, Dec 3, 2017 at 6:00 AM, Aleks-Daniel Jakimenko-Aleksejev via RT <
perl6-bugs-follo...@perl.org> wrote:

> Hmmm… Parrot is in the past as of today, and I wish it was possible to try
> this
> on MoarVM. What's the way to reproduce this issue?
>
> On 2014-07-14 02:31:54, teodozjan wrote:
> > Evaling objects won't work if code that eval was preompiled
> > independently. In this case class Planet and Class SpaceStation are
> > somewhat inaccesible in imported sub. Even though putting slurp $path
> > as argument of eval will fail. It was working on parrot but before big
> > changes that made parrot backend unusable (random issues) in my
> > project.
> >
> > =begin pod
> > #FAILS on MOAR
> > @planets = from_file($path_planets);
> > #the same as below
> > # https://github.com/teodozjan/perl-
> > store/blob/master/lib/PerlStore/FileStore.pm
> > @stations = from_file($path_stations);
> >
> > =end pod
> >
> >
> > #moar hack
> > note 'Readin $path_planets';
> > my $plan = slurp $path_planets;
> > @planets = EVAL $plan;
> >
> > #moar hack
> > note 'Readin $path_stations';
> > my $stat = slurp $path_stations;
> > @stations = EVAL $stat;
> >
> >
> >
> > >>> LOADING /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client
> > + /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client (12 - 16)
> > | multi sub MAIN(:$tasks!, Bool :$update?){
> > |
> > | my Client $client .= new;
> > |
> > | create_session;
> > > r
> > >>> LOADING EVAL_0
> > >>> LOADING EVAL_1
> > >>> LOADING EVAL_2
> > + Uncaught Exception
> > | Cannot invoke this object (REPR: Null, cs = 0)
> > + /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client (23 - 27)
> > | BodyBuilder.process_all_bodies;
> > | } else {
> > | BodyBuilder.read;
> > | }
> > | for @todo -> $willdo {
> > > q
> > - Run END blocks (y/N)?
> >
> > $ perl6 --version
> > This is perl6 version 2014.06-118-gb25b868 built on MoarVM version
> > 2014.06-63-g0fb638b
>
>


-- 
Pozdrawiam

Kamil Kułaga


Re: [perl #122289] [BUG] unexpected behaviour during EVAL()

2017-12-04 Thread Kamil Kułaga
Hi Aleks,

Thanks for reminder i totally forgot about this RT.

Looks like it was fine in 2015
https://github.com/teodozjan/lacuna-cookbuk/commit/f2ebae3efda06f35b1d679e17e14c259bd718b95#diff-73e69e63f060cafc548379f4dcc52105
shall i test it to be 100% sure or you want to close it?

On Sun, Dec 3, 2017 at 6:00 AM, Aleks-Daniel Jakimenko-Aleksejev via RT <
perl6-bugs-follo...@perl.org> wrote:

> Hmmm… Parrot is in the past as of today, and I wish it was possible to try
> this
> on MoarVM. What's the way to reproduce this issue?
>
> On 2014-07-14 02:31:54, teodozjan wrote:
> > Evaling objects won't work if code that eval was preompiled
> > independently. In this case class Planet and Class SpaceStation are
> > somewhat inaccesible in imported sub. Even though putting slurp $path
> > as argument of eval will fail. It was working on parrot but before big
> > changes that made parrot backend unusable (random issues) in my
> > project.
> >
> > =begin pod
> > #FAILS on MOAR
> > @planets = from_file($path_planets);
> > #the same as below
> > # https://github.com/teodozjan/perl-
> > store/blob/master/lib/PerlStore/FileStore.pm
> > @stations = from_file($path_stations);
> >
> > =end pod
> >
> >
> > #moar hack
> > note 'Readin $path_planets';
> > my $plan = slurp $path_planets;
> > @planets = EVAL $plan;
> >
> > #moar hack
> > note 'Readin $path_stations';
> > my $stat = slurp $path_stations;
> > @stations = EVAL $stat;
> >
> >
> >
> > >>> LOADING /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client
> > + /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client (12 - 16)
> > | multi sub MAIN(:$tasks!, Bool :$update?){
> > |
> > | my Client $client .= new;
> > |
> > | create_session;
> > > r
> > >>> LOADING EVAL_0
> > >>> LOADING EVAL_1
> > >>> LOADING EVAL_2
> > + Uncaught Exception
> > | Cannot invoke this object (REPR: Null, cs = 0)
> > + /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client (23 - 27)
> > | BodyBuilder.process_all_bodies;
> > | } else {
> > | BodyBuilder.read;
> > | }
> > | for @todo -> $willdo {
> > > q
> > - Run END blocks (y/N)?
> >
> > $ perl6 --version
> > This is perl6 version 2014.06-118-gb25b868 built on MoarVM version
> > 2014.06-63-g0fb638b
>
>


-- 
Pozdrawiam

Kamil Kułaga


Re: Observations from a C++/Python developer that never used Perl5

2016-09-08 Thread Kamil Kułaga
On Thu, Sep 8, 2016 at 4:00 AM, Joseph Garvin <joseph.h.gar...@gmail.com> wrote:
> * I can find no concise easy-to-understand explanation for how to define
> what other languages would call constructors. Instead there is a mess of
> bless, magic inside Mu, new, BUILD, BUILDALL... It's not clear when you
> should prefer to override BUILD or new or both. I also assume there are some
> benefits to teasing apart object construction this way, but right now I
> don't know what they are. This is also an area where I think there are older
> blog posts confusing the situation because they discuss semantics from an
> older version of Perl6.

In perl6 default way is to not write new, BUILD or BUILDALL and also
not to write accessors. When you create object you can provide
attributes to initialize, default accessors are generated if field is
declared with $. sigil. OOp was designed to not write the same code
everytime. When I started using perl6 the doc didn't told me it but
IMHO the best way to learn is read others code.

> I haven't been able to find any guidance on when I should be using a role and 
> when I should be using a class. The former seem to give you better error 
> messages when you forget to define a method from a base role... So never use 
> classes? I suspect it's more complicated than that.

Roles are similar to mixins. You can add something to class without
all complications of multi inheritance. IMHO *is* and *does* keywords
in most cases explain best whether you want class or role.  I
generally use classes for data and roles for code because I like  to
separate data form implementation. I hurt a lot of times while was
trying to do java programming with perl6 then I realized roles are not
interfaces and code is not compiled in static language sense.

-- 
Regards

Kamil Kułaga


[perl #128154] Cannot use qqx in rakudo star on windows7

2016-05-16 Thread Kamil Kułaga
# New Ticket Created by  "Kamil Kułaga" 
# Please include the string:  [perl #128154]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=128154 >


$ perl6 -v
This is Rakudo version 2016.04 built on MoarVM version 2016.04
implementing Perl 6.c.

$ perl6
To exit type 'exit' or '^D'
> qqx{dir}
Unable to read from 'dir'
  in block  at  line 1




Re: Workaround for Perl 5's __DATA__

2016-01-18 Thread Kamil Kułaga
You may be happy with =finish block

use v6;

say $=finish.split("\n").perl;


=finish
_
I like pancakes
And apples

On Sat, Jan 16, 2016 at 8:07 PM, Tom Browder <tom.brow...@gmail.com> wrote:
> I have tried this in my Perl 6 code (v6.c):
>
> =begin DATA
> blah
> blah2
> =end DATA
>
> Then:
>
> for $=DATA.lines -> $line {
>   # process a line
> }
>
> but I get this message:
>
> Pod variable @=DATA not yet implemented. Sorry.
>
> Is there any workaround for this other than putting the data in an array?
>
> Thanks.
>
> Best regards,
>
> -Tom



-- 
Pozdrawiam

Kamil Kułaga


[perl #126654] [POD] Formatting codes does not work inside declarator blocks

2015-11-16 Thread Kamil Kułaga
# New Ticket Created by  "Kamil Kułaga" 
# Please include the string:  [perl #126654]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=126654 >


Examples in spec http://design.perl6.org/S26.html#Declarator_blocks
contain formatting codes so I assume it is valid as in any other vlock

 use v6;
 
 #| 
 class Foo{
 #=[
 B
 ]
   has $.a;
 }

output:
 perl6 --doc /tmp/tst.pl6
 class Foo
 
 B

expected:
 perl6 --doc /tmp/tst.pl6
 class Foo
 
 bar

This is perl6 version 2015.10-323-gb18ada0 built on MoarVM version 
2015.10-92-g0181385



[perl #126634] Enums pollute type information

2015-11-13 Thread Kamil Kułaga
# New Ticket Created by  "Kamil Kułaga" 
# Please include the string:  [perl #126634]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=126634 >


I got very often this bug when instead of real type I have two dimensional 
array of BuildingEnum. This is shortest way to reproduce:

reproducing:
panda --notests install LacunaCookbuk::Client
unpack RT attachment
run perl6 ~/pod6-coverage/lib/Pod/Coverage.pm6

expected:
 $var = $["Model", "Logic"]


actual:
   
Array[LacunaCookbuk::Logic::Chairman::BuildingEnum][LacunaCookbuk::Logic::Chairman::BuildingEnum]
 $var = $["Model", "Logic"]



pod6-coverage.tar.gz
Description: GNU Zip compressed data


Adding doc on the fly during --doc

2015-11-07 Thread Kamil Kułaga
Hi,

I know design allows to alter pod building during DOC INIT and DOC BEGIN phases
I'm curious is it possible display undocumented things as it had doc?
I would find it useful to display all public stuff from class as part
of doc.

-- 
Regards

Kamil Kułaga


[perl #126485] Rat becomes Num

2015-10-29 Thread Kamil Kułaga
# New Ticket Created by  "Kamil Kułaga" 
# Please include the string:  [perl #126485]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=126485 >


I've tried to substitute numeric with Rat (and the switch to FatRat) but found 
some issues in type checking. Errors does not occur on simple examples so I 
provide whole code.

  $!total_interest += $interests.Rat; 

Normally it is not a problem to += two rats but here it becomes a problem. 

$ perl6 -v
 This is perl6 version 2015.10-46-g3c17701 built on MoarVM version 2015.10
$ export MVM_SPESH_DISABLE=1
$ panda install ./  
 
==> Installing Mortage from a local directory './'
==> Fetching Mortage
==> Building Mortage
==> Testing Mortage
Type check failed in assignment to $!total_interest; expected Rat but got 
Num
in method throw at 
/home/kamil/.rakudobrew/moar-nom/install/share/perl6/runtime 
/CORE.setting.moarvm:1
in method calc at 
/home/kamil/mortage6/.panda-work/1446107022_1/lib/Mortage.pm6:89
in block  at t/test.t:59


mortage6.tar.gz
Description: GNU Zip compressed data


Re: What are Perl 6's killer advantages over Perl 5?

2015-08-12 Thread Kamil Kułaga
One thing that was not mentioned already is using Rat instead of
standard floating point number. It prevents many silly mistakes
especially when counting money.

On Tue, Aug 11, 2015 at 2:12 PM, Tom Browder tom.brow...@gmail.com wrote:
 I have seen several lists of new Perl 6 features (versus Perl 5) but they
 all seem to be lists that intermix features with varying degrees of value to
 ordinary Perl 5 users.  If one wants to sell long-time Perl 5 users
 (already using the latest Perl 5, Moose, etc.) on the value of Perl 6, what
 should be on the important feature list?

 For me, stronger typing, named subroutine arguments, better classes and
 namespaces, object methods, and eventually better concurrency and compiled
 program persistence are among goodies long awaited.

 Thanks.

 -Tom

 The reason for my request is to help with a better introduction in my modest
 draft tutorial on converting Perl 5 to Perl 6 code at the Perl Monastery.  I
 am comfortable with the example code I use there (which is not currently
 intended to showcase new features), but I am getting several comments on why
 one should even bother with Perl 6?



-- 
Pozdrawiam

Kamil Kułaga


Re: UDP suport in rakudo

2015-06-18 Thread Kamil Kułaga
I will observe this branch then. I wanted to write an app listening to
snmp and I'don't know what will be required yet. Thanks for info :-)

On Thu, Jun 18, 2015 at 2:39 PM, Timo Paulssen t...@wakelift.de wrote:

 On 06/18/2015 09:47 AM, Kamil Kułaga wrote:
 Hi,

 Is it possible to listen UDP port with perl6?

 IO::Socket::INET seems to be TCP only

 At least on MoarVM we don't have UDP support yet. I've started in a
 little branch called udp_sockets in both MoarVM and NQP, but I didn't
 get terribly far. Just a few days ago I actually remembered it'd be a
 good idea to resume that work and - given the right amount of tuits - I
 suppose I can do just that.

 If you have any particular ideas for API, behavior, stuff you want to
 have available etc, please go ahead and share :)
   - Timo



-- 
Pozdrawiam

Kamil Kułaga


UDP suport in rakudo

2015-06-18 Thread Kamil Kułaga
Hi,

Is it possible to listen UDP port with perl6?

IO::Socket::INET seems to be TCP only



-- 
Pozdrawiam

Kamil Kułaga


Re: Favorite (Xe|E)macs mode script for Perl 6?

2015-04-05 Thread Kamil Kułaga
Hi Tom,

I tried two modes in emacs.  https://github.com/jrockway/cperl-mode
that is based on cperl-mode that I personally don't like but seems to
be most working. And there is tiny https://github.com/lue/p6mode that
is more like perl-mode but really basic even author says: So it's not
*totally* unuseable at this point :) . I hope .

.

On Sat, Apr 4, 2015 at 12:51 PM, Tom Browder tom.brow...@gmail.com wrote:
 I've found a couple of references to *emacs modes for Perl 6 on the net.  I
 use Xemacs and would appreciate hearing from anyone on a recommended Perl 6
 mode script for it.

 Thanks.

 Best,

 ~Tom



-- 
Pozdrawiam

Kamil Kułaga


Re: Getting startes with Perl6 / Rakudo Star / MoarVM

2014-09-11 Thread Kamil Kułaga
Hi,

Install path is known limitation
https://github.com/rakudo/star/issues/10 If you want custom path you
need to compile it from source for now

Where to begin?

I propose to start:
 http://perlgeek.de/en/article/5-to-6 to know biggest differences

then:
 http://doc.perl6.org/language.html and of course rest of
http://doc.perl6.org/

If you want something really verbose http://perlcabal.org/syn/ Even
though it is mainly targeted to compiler authors it great because is
the most complete

Also http://perl6.org contains link to other resources

I hope didn't write to much for a first time

On Wed, Sep 10, 2014 at 9:07 PM, Alex Becker asb.c...@gmail.com wrote:
 Hi!

 I downloaded rakudo-star-2014.08-moar.msi.
 When it was done, luckily, I noticed that it installed on C:\rakudo.
 It was luck because no message indicated that install location and I found
 it only because I checked if the installer would really put it on my small
 OS SSD (= bad).

 Then, I searched for the documentation. I'm sorry, I didn't find it. Where
 is it? I expected some doc folder, a web page, or a link in the start menu
 (I like that best).

 Is there a getting started guide?

 I want to check if some of my scripts work with Perl 6.

 Best regards,
 Alex



-- 
Pozdrawiam

Kamil Kułaga


Orphaned module Form

2014-09-08 Thread Kamil Kułaga
Hi,

There is a https://github.com/mathw/form trying to implement
http://search.cpan.org/~dconway/Perl6-Form-0.005/lib/Perl6/Form.pm

Module is still usable but fails tests.

retupmoca has prepared https://github.com/masak/data-pretty/pull/1 but
mathw seems to be no longer active on github.

My question is: Shall https://github.com/perl6 community adopt it or
maybe someone should fork it and change link in
https://github.com/perl6/ecosystem/blob/master/META.list?




-- 
Pozdrawiam

Kamil Kułaga


[perl #122289] [BUG] unexpected behaviour during EVAL()

2014-07-14 Thread Kamil Kułaga
# New Ticket Created by  Kamil Kułaga 
# Please include the string:  [perl #122289]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=122289 


 Evaling objects won't work if code that eval was preompiled
independently. In this case class Planet and Class SpaceStation are
somewhat inaccesible in imported sub. Even though putting slurp $path
as argument of eval will fail. It was working on parrot but before big
changes that made parrot backend unusable (random issues) in my
project.

=begin pod
#FAILS on MOAR
@planets = from_file($path_planets);
#the same as below
# 
https://github.com/teodozjan/perl-store/blob/master/lib/PerlStore/FileStore.pm
@stations = from_file($path_stations);

=end pod


#moar hack
note 'Readin $path_planets';
my $plan = slurp $path_planets;
@planets = EVAL $plan;

#moar hack
note 'Readin $path_stations';
my $stat =  slurp $path_stations;
@stations = EVAL $stat;



 LOADING /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client
+ /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client (12 - 16)
| multi sub MAIN(:$tasks!, Bool :$update?){
|
|   my Client $client .= new;
|
|   create_session;
 r
 LOADING EVAL_0
 LOADING EVAL_1
 LOADING EVAL_2
+ Uncaught Exception
| Cannot invoke this object (REPR: Null, cs = 0)
+ /home/kamil/dev/lacuna-cookbuk/bin/lacunacookbuk_client (23 - 27)
|   BodyBuilder.process_all_bodies;
|   } else {
|   BodyBuilder.read;
|   }
|   for @todo - $willdo {
 q
- Run END blocks (y/N)?

$ perl6 --version
This is perl6 version 2014.06-118-gb25b868 built on MoarVM version
2014.06-63-g0fb638b

-- 
Pozdrawiam

Kamil Kułaga


[perl #122226] [BUG] Cannot invoke null object on moar while compiling or using JSON::RPC

2014-07-04 Thread Kamil Kułaga
# New Ticket Created by  Kamil Kułaga 
# Please include the string:  [perl #16]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=16 


Discussion: http://irclog.perlgeek.de/moarvm/2014-07-04

It worked on parrot.

It don't work on moar for long:
MOAR version This is perl6 version 2014.06-56-g44d5357 built on MoarVM
version 2014.06-40-g6b458f7


kamil@gdn-vc-kamilku:~/dev/sandbox$ perl6-debug-m --ll-exception fail.pl
 LOADING fail.pl
+ fail.pl (3 - 7)
| use JSON::RPC::Client;
|
| my $c = JSON::RPC::Client.new(url = 'http://us1.lacunaexpanse.com/empire');
| $c.login(:api_key('07a052e0-d92b-49bb-ad38-cc1e433eb869'),
|:Empire('password'));
 r
 LOADING eval_0
Cannot invoke null object
   at lib/JSON/RPC/Client.pm:21
(/home/kamil/rakudo/install/languages/perl6/site/lib/JSON/RPC/Client.moarvm::40)
 from src/gen/m-Metamodel.nqp:2604
(/home/kamil/rakudo/install/languages/nqp/lib/Perl6/Metamodel.moarvm:find_method_fallback:53)
 from src/gen/m-Metamodel.nqp:934
(/home/kamil/rakudo/install/languages/nqp/lib/Perl6/Metamodel.moarvm:find_method:109)
 from fail.pl:6  (ephemeral file::74)
 from fail.pl:1  (ephemeral file::10)
 from gen/moar/stage2/NQPHLL.nqp:1108
(/home/kamil/rakudo/install/languages/nqp/lib/NQPHLL.moarvm:eval:174)
 from src/gen/m-perl6-debug.nqp:447
(/home/kamil/rakudo/install/languages/perl6/runtime/perl6-debug.moarvm:eval:96)
 from gen/moar/stage2/NQPHLL.nqp:1300
(/home/kamil/rakudo/install/languages/nqp/lib/NQPHLL.moarvm:evalfiles:90)
 from gen/moar/stage2/NQPHLL.nqp:1204
(/home/kamil/rakudo/install/languages/nqp/lib/NQPHLL.moarvm:command_eval:212)
 from src/Perl6/Compiler.nqp:17
(/home/kamil/rakudo/install/languages/nqp/lib/Perl6/Compiler.moarvm:command_eval:116)
 from gen/moar/stage2/NQPHLL.nqp:1179
(/home/kamil/rakudo/install/languages/nqp/lib/NQPHLL.moarvm:command_line:116)
 from src/gen/m-perl6-debug.nqp:497
(/home/kamil/rakudo/install/languages/perl6/runtime/perl6-debug.moarvm:MAIN:190)
 from src/gen/m-perl6-debug.nqp:440
(/home/kamil/rakudo/install/languages/perl6/runtime/perl6-debug.moarvm::68)
 from unknown:1
(/home/kamil/rakudo/install/languages/perl6/runtime/perl6-debug.moarvm::8)
 from unknown:1
(/home/kamil/rakudo/install/languages/perl6/runtime/perl6-debug.moarvm::9)



-- 
Pozdrawiam

Kamil Kułaga


Diffrence between is and does in scope of overriding multi methods

2014-06-27 Thread Kamil Kułaga
Hi,

I would like to ask for help in understanding difference between this code:

   use v6;

   role X {
   multi method xyz(Any $a) {say Class X}
}

class Y does X {
multi method xyz(Any $a) {say Class Y}
}

say Y.new.xyz(1);

$ perl6 tst.pl
 Ambiguous call to 'xyz'; these signatures all match:
 :(Y: Any $a, *%_)
 :(Y: Any $a, *%_)
  in block  at tst.pl:26

And this code:
   use v6;

   class X {
   multi method xyz(Any $a) {say Class X}
}

class Y is X {
multi method xyz(Any $a) {say Class Y}
}

say Y.new.xyz(1);

$ perl6 tst.pl
Class Y
True

It is hard to google such common words like is and does :)

-- 
Pozdrawiam

Kamil Kułaga


Re: Diffrence between is and does in scope of overriding multi methods

2014-06-27 Thread Kamil Kułaga
Hi Timo,

After I read your explanation and now it is even logical to use role
punning in my app. In most cases I don't want to override this default
behavior of method xyz but I would like to add new specific one. Only
one class does opposite so it should be subclass of a role.

On Fri, Jun 27, 2014 at 3:25 PM, Timo Paulssen t...@wakelift.de wrote:
 On 27/06/14 10:07, Kamil Kułaga wrote:

 Hi,

 I would like to ask for help in understanding difference between this
 code:

 use v6;

 role X {
 multi method xyz(Any $a) {say Class X}
  }

  class Y does X {
  multi method xyz(Any $a) {say Class Y}
  }

  say Y.new.xyz(1);

  $ perl6 tst.pl
   Ambiguous call to 'xyz'; these signatures all match:
   :(Y: Any $a, *%_)
   :(Y: Any $a, *%_)
in block  at tst.pl:26

 And this code:
 use v6;

 class X {
 multi method xyz(Any $a) {say Class X}
  }

  class Y is X {
  multi method xyz(Any $a) {say Class Y}
  }

  say Y.new.xyz(1);

  $ perl6 tst.pl
  Class Y
  True

 It is hard to google such common words like is and does :)


 Hey Kamil,

 What happens when you does a role in a class, you mix in all the methods
 at the same level, basically as if you had copy-pasted the method
 declarations over. That's why you get the error that the call to xyz is
 ambiguous.

 When you is a class, you derive from it. That's why the multi method
 X::xyz gets overwritten by Y::xyz, as the signature is identical.

 At least that's my understanding.

 Btw, you can also is a role, in which case it will get punned into a
 class. That operation is equivalent to declaring a class with an empty body
 that does the given role. So in the upper example, with role X and class
 Y, you could is X and get the same behavior as in the lower example.

 Hope to help (and hope what I wrote is actually accurate)
   - Timo



-- 
Pozdrawiam

Kamil Kułaga


Re: Code execution during compilation

2014-06-15 Thread Kamil Kułaga
Ok,

I've read SYN-04 Phasers and I think I should use INIT {} or END {}

Are there any situations INIT {} / END {} will not postpone execution?
Because in my case it is still executed during compilation
https://github.com/teodozjan/lacuna-cookbuk/tree/init_problems

On Sun, Jun 15, 2014 at 12:45 PM, Moritz Lenz mor...@faui2k3.org wrote:
 Hi,

 class and role bodies are executed at compile time, so yes, that's
 expected. The same thing happens in BEGIN blocks.

 (Actually, the case with roles is more complicated; iirc their bodies
 are executed at role application time, but in your example, 'class B
 does Xx' runs at compile time, so the two are roughly equivalent).

 Cheers,
 Moritz

 On 06/15/2014 02:31 AM, Kamil Kułaga wrote:
 Hi,

 I got amazed little bit when this code:
 class A {
  method wow{say I'm alive}
 }

 role Xx{
   my $th = A.wow;
 }


 class B does Xx {
 }

 Started to live during compilation (also tried with ufo):

 $ perl6 -o o.pir funnyrole.pl
 I'm alive


 Is this expected or subject to change?




-- 
Pozdrawiam

Kamil Kułaga


Re: Rewrite using map? Trasformation array into hash of hash

2014-06-14 Thread Kamil Kułaga
Dear Timo.

So .categorize and .classify wil always end with list on leaves of
produced tree? Ok I can live with that :)

On Sat, Jun 14, 2014 at 12:30 PM,  t...@wakelift.de wrote:
 Dear Kamil,


 On 06/13/2014 10:24 PM, Kamil Kułaga wrote:
 my %h = categorize({map {[.a , .b]}, $_},@array);

 I think the problem is that categorize will call your inner code block for
 every item in the @array. Then you map your {[.a, .b]} over that item, so
 you end up with a single-item list as a result. Could that be the problem?

 Cheers
   - Timo



-- 
Pozdrawiam

Kamil Kułaga


Code execution during compilation

2014-06-14 Thread Kamil Kułaga
Hi,

I got amazed little bit when this code:
class A {
 method wow{say I'm alive}
}

role Xx{
  my $th = A.wow;
}


class B does Xx {
}

Started to live during compilation (also tried with ufo):

$ perl6 -o o.pir funnyrole.pl
I'm alive


Is this expected or subject to change?
-- 
Pozdrawiam

Kamil Kułaga


Re: Code execution during compilation

2014-06-14 Thread Kamil Kułaga
Of course ment
   perl6 --target=pir --output=o.pir funnyrole.pl
but with same effect
On Sun, Jun 15, 2014 at 2:31 AM, Kamil Kułaga teodoz...@gmail.com wrote:
 Hi,

 I got amazed little bit when this code:
 class A {
  method wow{say I'm alive}
 }

 role Xx{
   my $th = A.wow;
 }


 class B does Xx {
 }

 Started to live during compilation (also tried with ufo):

 $ perl6 -o o.pir funnyrole.pl
 I'm alive


 Is this expected or subject to change?
 --
 Pozdrawiam

 Kamil Kułaga



-- 
Pozdrawiam

Kamil Kułaga


Rewrite using map? Trasformation array into hash of hash

2014-06-13 Thread Kamil Kułaga
Hi,

I was wondering whether following code can be rewritten using map/grep
construct.


class A {
   has $.a;
   has $.b;
   }


   my @array= (
   A.new(a='a', b='11'),
   A.new(a='a', b='22'),
   A.new(a='v', b='33'),
   A.new(a='w', b='44'),
   A.new(a='v', b='55')
   );



   my %hash;
   for @array - $elem {
   %hash{$elem.a}{$elem.b} =$elem;
}


say %hash.perl;

Can it?


-- 
Pozdrawiam

Kamil Kułaga


Re: Rewrite using map? Trasformation array into hash of hash

2014-06-13 Thread Kamil Kułaga
Hi Tobias,

Almost. At least at my rakudo creates list of hash of hash and loses
data while converting to hash:

(a = 11 = A.new(a = a, b = 11), a = 22 = A.new(a =
a, b = 22), v = 33 = A.new(a = v, b = 33), w =
44 = A.new(a = w, b = 44), v = 55 = A.new(a = v, b
= 55)).list.item


On Fri, Jun 13, 2014 at 2:30 PM, Tobias Leich em...@froggs.de wrote:
 Hi, like that?

 class A { has $.a; has $.b };
 my @array = A.new(a='a', b='11'),
 A.new(a='a', b='22'),
 A.new(a='v', b='33'),
 A.new(a='w', b='44'),
 A.new(a='v', b='55');

 say @array.map({ .a = .b = $_ })

 OUTPUT«a = 11 = A.new(a = a, b = 11) a = 22 = A.new(a
 = a, b = 22) v = 33 = A.new(a = v, b = 33) w = 44
 = A.new(a = w, b = 44) v = 55 = A.new(a = v, b = 55)␤»

 Am 13.06.2014 12:36, schrieb Kamil Kułaga:
 Hi,

 I was wondering whether following code can be rewritten using map/grep
 construct.


 class A {
has $.a;
has $.b;
}


my @array= (
A.new(a='a', b='11'),
A.new(a='a', b='22'),
A.new(a='v', b='33'),
A.new(a='w', b='44'),
A.new(a='v', b='55')
);



my %hash;
for @array - $elem {
%hash{$elem.a}{$elem.b} =$elem;
 }


 say %hash.perl;

 Can it?






-- 
Pozdrawiam

Kamil Kułaga


Re: Rewrite using map? Trasformation array into hash of hash

2014-06-13 Thread Kamil Kułaga
Ok got it. But solution is neither more readable nor faster (IMHO only
- I didn't benchmark it)


class A { has $.a; has $.b };
my @array = A.new(a='a', b='11'),
A.new(a='a', b='22'),
A.new(a='v', b='33'),
A.new(a='w', b='44'),
A.new(a='v', b='55');

my %h = @array.map({
my $var = .a;
$var = %(@array.grep({.a eq $var}).map({.b = $_}))
   });

say %ha.perl;

my %hash;
for @array - $elem {
%hash{$elem.a}{$elem.b} =$elem;
}


say Reference\n ~ %hasha.perl;


On Fri, Jun 13, 2014 at 4:49 PM, Kamil Kułaga teodoz...@gmail.com wrote:
 Hi Tobias,

 Almost. At least at my rakudo creates list of hash of hash and loses
 data while converting to hash:

 (a = 11 = A.new(a = a, b = 11), a = 22 = A.new(a =
 a, b = 22), v = 33 = A.new(a = v, b = 33), w =
 44 = A.new(a = w, b = 44), v = 55 = A.new(a = v, b
 = 55)).list.item


 On Fri, Jun 13, 2014 at 2:30 PM, Tobias Leich em...@froggs.de wrote:
 Hi, like that?

 class A { has $.a; has $.b };
 my @array = A.new(a='a', b='11'),
 A.new(a='a', b='22'),
 A.new(a='v', b='33'),
 A.new(a='w', b='44'),
 A.new(a='v', b='55');

 say @array.map({ .a = .b = $_ })

 OUTPUT«a = 11 = A.new(a = a, b = 11) a = 22 = A.new(a
 = a, b = 22) v = 33 = A.new(a = v, b = 33) w = 44
 = A.new(a = w, b = 44) v = 55 = A.new(a = v, b = 55)␤»

 Am 13.06.2014 12:36, schrieb Kamil Kułaga:
 Hi,

 I was wondering whether following code can be rewritten using map/grep
 construct.


 class A {
has $.a;
has $.b;
}


my @array= (
A.new(a='a', b='11'),
A.new(a='a', b='22'),
A.new(a='v', b='33'),
A.new(a='w', b='44'),
A.new(a='v', b='55')
);



my %hash;
for @array - $elem {
%hash{$elem.a}{$elem.b} =$elem;
 }


 say %hash.perl;

 Can it?






 --
 Pozdrawiam

 Kamil Kułaga



-- 
Pozdrawiam

Kamil Kułaga


Re: Rewrite using map? Trasformation array into hash of hash

2014-06-13 Thread Kamil Kułaga
Dear Timo,

I'm almost done with categorize. I stole similar example from rakudo
tests but I can't get rid off array  on end. If I remove from map []
it stops working.

PS. I barely understand code I wrote anyway :)


$ perl6 ~/xx.pl
[A.new(a = a, b = 22)]
Reference
A.new(a = a, b = 22)



use v6;

class A { has $.a; has $.b };
my @array = A.new(a='a', b='11'),
A.new(a='a', b='22'),
A.new(a='v', b='33'),
A.new(a='w', b='44'),
A.new(a='v', b='55');


my %h = categorize({map {[.a , .b]}, $_},@array);

say %ha22.perl;

my %hash;
for @array - $elem {
%hash{$elem.a}{$elem.b} =$elem;
}


say Reference\n ~ %hasha22.perl;

On Fri, Jun 13, 2014 at 9:08 PM,  t...@wakelift.de wrote:
 On 06/13/2014 08:15 PM, Kamil Kułaga wrote:
 Ok got it. But solution is neither more readable nor faster (IMHO only
 - I didn't benchmark it)


 class A { has $.a; has $.b };
 my @array = A.new(a='a', b='11'),
 A.new(a='a', b='22'),
 A.new(a='v', b='33'),
 A.new(a='w', b='44'),
 A.new(a='v', b='55');

 my %h = @array.map({
 my $var = .a;
 $var = %(@array.grep({.a eq $var}).map({.b = $_}))
});

 say %ha.perl;

 my %hash;
 for @array - $elem {
 %hash{$elem.a}{$elem.b} =$elem;
 }


 say Reference\n ~ %hasha.perl;

 Dear Kamil,

 the method categorize, as specced in
 http://perlcabal.org/syn/S32/Containers.html#categorize will allow you
 to return a parcel from the categorization you provide (such as - $_
 { (.a, .b) }) and build a multi-leveled hash.

 Sadly, I wasn't able to make it work right away.

 Cheers,
   - Timo




-- 
Pozdrawiam

Kamil Kułaga


Re: Is passing excess parameters while creating object legal?

2014-05-28 Thread Kamil Kułaga
Hi Tadzik and timo,

Timo: Thanks for pointing information in synopsis. Now I understand
why it works this way.

Tadzik: Actually I used this as a feature in my
https://github.com/teodozjan/lacuna-cookbuk and was afraid that it
will stop working with some rakudo update but StrictConstructor in
some other cases may be a great idea.


On Tue, May 27, 2014 at 9:04 PM, Tadeusz Sośnierz
tadeusz.sosni...@onet.pl wrote:
 On 05/25/2014 09:50 AM, Kamil Kułaga wrote:

 Hi,

 My question is about passing parameters to .new method that do not
 correspond to any field in class. This example;

 use v6;

 class PersonalId{
  has Int $.number;
  has Str $.full_name;
 }

 my Hash $p; #just because i'm scared of pair conversions
 $p{number} = 13123123123;
 $p{full_name} = John Doe;
 $p{age}=64;
 $p{shoesize}=44;

 say PersonalId.new(|%($p)).perl;
 # PersonalId.new(number = 13123123123, full_name = John Doe)

 Works perfectly fine but I don't know whether I can rely on that. S12
 speaks only about type objects: (It is allowed to pass type objects
 that don't correspond to any parent class.)


 Hello Kamil,
 Why the behaviour above is correct and documented, you may find it bug-prone
 or inconvenient. To address that, I've ported MooseX::StrictConstructor to
 Perl 6[1]. Here's example usage demonstrated on a piece of code similar to
 yours:

 use v6;
 use ClassX::StrictConstructor;

 class PersonalId does ClassX::StrictConstructor {
 has Int $.number;
 has Str $.full_name;
 }

 PersonalId.new(number = 7,
full_name = Edgar Poe,
yada = 'yada');
 # Output:
 # The following attributes are not declared for type PersonalId: yada
 #  in method new at /yada/yada/StrictConstructor.pm:32
 #  in block  at test.pl:9

 It may come to your liking :)

 Best regards,
 Tadeusz Sośnierz


 [1] https://github.com/tadzik/ClassX-StrictConstructor



-- 
Pozdrawiam

Kamil Kułaga


Is passing excess parameters while creating object legal?

2014-05-25 Thread Kamil Kułaga
Hi,

My question is about passing parameters to .new method that do not
correspond to any field in class. This example;

use v6;

class PersonalId{
has Int $.number;
has Str $.full_name;
}

my Hash $p; #just because i'm scared of pair conversions
$p{number} = 13123123123;
$p{full_name} = John Doe;
$p{age}=64;
$p{shoesize}=44;

say PersonalId.new(|%($p)).perl;
# PersonalId.new(number = 13123123123, full_name = John Doe)

Works perfectly fine but I don't know whether I can rely on that. S12
speaks only about type objects: (It is allowed to pass type objects
that don't correspond to any parent class.)


-- 
Pozdrawiam

Kamil Kułaga


Re: Does perl have ensue override?

2014-05-20 Thread Kamil Kułaga
Hi Moritz,

Couldn't this be achieved by custom made metaclass?

I was trying to adapt examples from advent calendar and S12 and I lost
:( because my metaclass is not used by perl
https://gist.github.com/teodozjan/b7183c81c966cfeee3bd#file-incomplete-pl

On Mon, May 19, 2014 at 10:36 PM, Moritz Lenz mor...@faui2k3.org wrote:
 Hi Kamil,

 the good news is that I understand what causes the problem. The bad news
 is that it I don't have a solution yet.

 The trouble is that you can't really call methods on roles; roles are
 rather abstract things, and if you try to call a method on a role, Perl
 6 automatically creates a class for you, with the same name as the role.
 We call this process punning.

 Calling R.^can($methodname) causes punning, and the punned class doesn't
 implement the stubbed method. Thus the error message.

 Knowing that, one could just inspect the role's method table instead of
 calling .^can. However that's not so easy, because roles come in groups.
 Roles can be parametric, and multiple roles of the same name can be
 parameterized by different signatures, and applying a role to a class
 (possibly with a list of arguments) selects a candidate role, not just a
 single role candidate.

 So far I haven't seen any method in the ParametricRoleGroupHOW that
 gives me a list of those candidates, or a of methods. So I don't know
 how to emulate .^can.

 I'll see if anybody in #perl6 (IRC) has a good idea...

 Cheers,
 Moritz

 On 19.05.2014 14:52, Kamil Kułaga wrote:
 Hi Moritz,

 I've tried to adapt Your gist to something else but I've realized that
 it does not work with stubs. Is it possible to bypass problem with
 incomplete R?

 https://gist.github.com/teodozjan/b7183c81c966cfeee3bd

 I feel very inspired :)

 On Fri, May 16, 2014 at 10:44 AM, Moritz Lenz mor...@faui2k3.org wrote:
 Hi Kamil,


 On 05/15/2014 07:48 PM, Kamil Kułaga wrote:

 Is there any ordinary way (not something like getting list of methods
 from base class) to ensure we are overriding method?

 Java has @Override annotation that that causes compilation error if
 method is not necessary for Interface(Role). It is very handy if class
 does many of them and someone cuts out deprecated method and there is
 no reason to implement them any longer.


 Not by default, but the meta programming facilities make it just a small
 exercise to implement such a thing in user space.

 I've done that in
 https://gist.github.com/moritz/2c6ed01eef0029dabdeb

 Feel inspired :-)

 Cheers,
 Moritz






-- 
Pozdrawiam

Kamil Kułaga


Re: Does perl have ensue override?

2014-05-19 Thread Kamil Kułaga
Hi Moritz,

I've tried to adapt Your gist to something else but I've realized that
it does not work with stubs. Is it possible to bypass problem with
incomplete R?

https://gist.github.com/teodozjan/b7183c81c966cfeee3bd

I feel very inspired :)

On Fri, May 16, 2014 at 10:44 AM, Moritz Lenz mor...@faui2k3.org wrote:
 Hi Kamil,


 On 05/15/2014 07:48 PM, Kamil Kułaga wrote:

 Is there any ordinary way (not something like getting list of methods
 from base class) to ensure we are overriding method?

 Java has @Override annotation that that causes compilation error if
 method is not necessary for Interface(Role). It is very handy if class
 does many of them and someone cuts out deprecated method and there is
 no reason to implement them any longer.


 Not by default, but the meta programming facilities make it just a small
 exercise to implement such a thing in user space.

 I've done that in
 https://gist.github.com/moritz/2c6ed01eef0029dabdeb

 Feel inspired :-)

 Cheers,
 Moritz



-- 
Pozdrawiam

Kamil Kułaga


Does perl have ensue override?

2014-05-15 Thread Kamil Kułaga
Hi,

Is there any ordinary way (not something like getting list of methods
from base class) to ensure we are overriding method?

Java has @Override annotation that that causes compilation error if
method is not necessary for Interface(Role). It is very handy if class
does many of them and someone cuts out deprecated method and there is
no reason to implement them any longer.

-- 
Pozdrawiam

Kamil Kułaga


[perl #121811] [BUG] $*EXECUTABLE filled wrong on parrot

2014-05-07 Thread Kamil Kułaga
# New Ticket Created by  Kamil Kułaga 
# Please include the string:  [perl #121811]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=121811 


$*EXECUTABLE contains right path on moar but on parrot it is pwd+basename.

$ pwd
/home/kamil

$ perl6-m
 say $*EXECUTABLE
IO::Path/home/kamil/rakudo/install/bin/perl6-m
 say $*EXECUTABLE.basename
perl6-m


$ perl6-p
 say $*EXECUTABLE
IO::Path/home/kamil/perl6-p
 say $*EXECUTABLE.basename
perl6-p


PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/kamil/rakudo/install/bin:/home/kamil/rakudo/install/lib/parrot/6.1.0-devel/languages/perl6/site/bin

$ perl6-p --version
This is perl6 version 2014.04-191-g8574c4f built on parrot 6.1.0
revision RELEASE_6_1_0
$ perl6-m --version
This is perl6 version 2014.04-191-g8574c4f built on MoarVM version
2014.04-57-g61f9cdb



-- 
Pozdrawiam

Kamil Kułaga


Re: [perl #121804] AutoReply: [BUG]Array of Hash conversion and type check error and unexpected conversion to pair

2014-05-06 Thread Kamil Kułaga
Sorry for wrong output. For x method on parrot should be:
$ perl6-p ~/dev/sandbox/HashKing.pl
(Hash)
Type check failed for return value; expected 'Array[Hash]' but got 'Array[Hash]'
  in sub x at /home/kamil/dev/sandbox/HashKing.pl:8
  in block  at /home/kamil/dev/sandbox/HashKing.pl:15


Anyway only linenumbers and  method name change.

On Tue, May 6, 2014 at 11:27 AM, perl6 via RT
perl6-bugs-follo...@perl.org wrote:
 Greetings,

 This message has been automatically generated in response to the
 creation of a trouble ticket regarding:
 [BUG]Array of Hash conversion and type check error and unexpected 
 conversion to pair,
 a summary of which appears below.

 There is no need to reply to this message right now.  Your ticket has been
 assigned an ID of [perl #121804].

 Please include the string:

  [perl #121804]

 in the subject line of all future correspondence about this issue. To do so,
 you may reply to this message.

 Thank you,
 perl6-bugs-follo...@perl.org

 -
 Hi,

 I found some hash issues on moar and parrot

 perl6-p --version
 This is perl6 version 2014.04-181-gf374d87 built on parrot 6.1.0
 revision RELEASE_6_1_0
 perl6 --version
 This is perl6 version 2014.04-181-gf374d87 built on MoarVM version
 2014.04-49-gaa7bbef



 sub y returns Array of Hash{
 my %a1 = :x(y), :y(z), :w(c);
 my %a2 =:x(y), :y(t), :w(c);
 my %a3 = :x(y), :y(z), :w(h);


 my Hash $b1 = %a1;
 my Hash $b2 = %a2;
 my Hash $b3 = %a3;
 say $b1.WHAT;
 my Hash @array = $b1,$b2,$b3;
 }
 y;
 perl6 ~/dev/sandbox/HashKing.pl
 (Hash)
 Type check failed for return value; expected 'Array[Hash]' but got 
 'Array[Hash]'
   in any return_error at src/vm/moar/Perl6/Ops.nqp:598
   in sub y at /home/kamil/dev/sandbox/HashKing.pl:27
   in block  at /home/kamil/dev/sandbox/HashKing.pl:30

 perl6-p ~/dev/sandbox/HashKing.pl
 (Hash)
 Type check failed for return value; expected 'Array[Hash]' but got 
 'Array[Hash]'
   in sub y at /home/kamil/dev/sandbox/HashKing.pl:27
   in block  at /home/kamil/dev/sandbox/HashKing.pl:30

 sub x returns Array of Hash{
 my %a1 = :x(y), :y(z), :w(c);
 my %a2 =:x(y), :y(t), :w(c);
 my %a3 = :x(y), :y(z), :w(h);
 say %a1.WHAT;
 my Hash @array = %a1,%a2,%a3;
 }
 x;

 $ perl6 ~/dev/sandbox/HashKing.pl
 (Hash)
 Type check failed in assignment to '@array'; expected 'Hash' but got 'Pair'
   in method REIFY at src/gen/m-CORE.setting:8775
   in method reify at src/gen/m-CORE.setting:7611
   in method gimme at src/gen/m-CORE.setting:8049
   in method sink at src/gen/m-CORE.setting:8473
   in method BUILDALL at src/gen/m-CORE.setting:939
   in method bless at src/gen/m-CORE.setting:858
   in method new at src/gen/m-CORE.setting:843
   in any return_error at src/vm/moar/Perl6/Ops.nqp:598
   in sub x at /home/kamil/dev/sandbox/HashKing.pl:8
   in block  at /home/kamil/dev/sandbox/HashKing.pl:15

 $ perl6-p ~/dev/sandbox/HashKing.pl
 (Hash)
 Type check failed for return value; expected 'Array[Hash]' but got 
 'Array[Hash]'
   in sub y at /home/kamil/dev/sandbox/HashKing.pl:27
   in block  at /home/kamil/dev/sandbox/HashKing.pl:30


 --
 Pozdrawiam

 Kamil Kułaga




-- 
Pozdrawiam

Kamil Kułaga


[perl #121804] [BUG]Array of Hash conversion and type check error and unexpected conversion to pair

2014-05-06 Thread Kamil Kułaga
# New Ticket Created by  Kamil Kułaga 
# Please include the string:  [perl #121804]
# in the subject line of all future correspondence about this issue. 
# URL: https://rt.perl.org/Ticket/Display.html?id=121804 


Hi,

I found some hash issues on moar and parrot

perl6-p --version
This is perl6 version 2014.04-181-gf374d87 built on parrot 6.1.0
revision RELEASE_6_1_0
perl6 --version
This is perl6 version 2014.04-181-gf374d87 built on MoarVM version
2014.04-49-gaa7bbef



sub y returns Array of Hash{
my %a1 = :x(y), :y(z), :w(c);
my %a2 =:x(y), :y(t), :w(c);
my %a3 = :x(y), :y(z), :w(h);


my Hash $b1 = %a1;
my Hash $b2 = %a2;
my Hash $b3 = %a3;
say $b1.WHAT;
my Hash @array = $b1,$b2,$b3;
}
y;
perl6 ~/dev/sandbox/HashKing.pl
(Hash)
Type check failed for return value; expected 'Array[Hash]' but got 'Array[Hash]'
  in any return_error at src/vm/moar/Perl6/Ops.nqp:598
  in sub y at /home/kamil/dev/sandbox/HashKing.pl:27
  in block  at /home/kamil/dev/sandbox/HashKing.pl:30

perl6-p ~/dev/sandbox/HashKing.pl
(Hash)
Type check failed for return value; expected 'Array[Hash]' but got 'Array[Hash]'
  in sub y at /home/kamil/dev/sandbox/HashKing.pl:27
  in block  at /home/kamil/dev/sandbox/HashKing.pl:30

sub x returns Array of Hash{
my %a1 = :x(y), :y(z), :w(c);
my %a2 =:x(y), :y(t), :w(c);
my %a3 = :x(y), :y(z), :w(h);
say %a1.WHAT;
my Hash @array = %a1,%a2,%a3;
}
x;

$ perl6 ~/dev/sandbox/HashKing.pl
(Hash)
Type check failed in assignment to '@array'; expected 'Hash' but got 'Pair'
  in method REIFY at src/gen/m-CORE.setting:8775
  in method reify at src/gen/m-CORE.setting:7611
  in method gimme at src/gen/m-CORE.setting:8049
  in method sink at src/gen/m-CORE.setting:8473
  in method BUILDALL at src/gen/m-CORE.setting:939
  in method bless at src/gen/m-CORE.setting:858
  in method new at src/gen/m-CORE.setting:843
  in any return_error at src/vm/moar/Perl6/Ops.nqp:598
  in sub x at /home/kamil/dev/sandbox/HashKing.pl:8
  in block  at /home/kamil/dev/sandbox/HashKing.pl:15

$ perl6-p ~/dev/sandbox/HashKing.pl
(Hash)
Type check failed for return value; expected 'Array[Hash]' but got 'Array[Hash]'
  in sub y at /home/kamil/dev/sandbox/HashKing.pl:27
  in block  at /home/kamil/dev/sandbox/HashKing.pl:30


-- 
Pozdrawiam

Kamil Kułaga


Problems importing JSON::RPC::Client while in lib instead of bin

2014-04-30 Thread Kamil Kułaga
Hi,

I have no problem while importing JSON::RPC::Client directly in script
but when I try to move it into lib (the compiled ones) i get /STable
conflict detected during deserialization/. Am I doing something wrong
or there is a bug?

For easy reproduce I've created repository https://github.com/teodozjan/sandbox

I use rakudo compiled from repository. Deleted everything and built
different backend but it did not help.

kamil@perl6:~/dev/sandbox$ ufo
WARNING: You need to re-run ufo whenver you update to a new Rakudo version
kamil@perl6:~/dev/sandbox$ make install
mkdir -p blib/lib/Sandbox/
cp -p lib/Sandbox/Sclass.pm blib/lib/Sandbox/Sclass.pm
PERL6LIB=/home/kamil/dev/sandbox/blib/lib:/home/kamil/dev/sandbox/lib:
perl6-m --target=mbc --output=blib/lib/Sandbox/Sclass.moarvm
lib/Sandbox/Sclass.pm
mkdir -p blib/lib/Sandbox/
cp -p lib/Sandbox/Sclassb.pm blib/lib/Sandbox/Sclassb.pm
PERL6LIB=/home/kamil/dev/sandbox/blib/lib:/home/kamil/dev/sandbox/lib:
perl6-m --target=mbc --output=blib/lib/Sandbox/Sclassb.moarvm
lib/Sandbox/Sclassb.pm
mkdir -p /home/kamil/rakudo/install/languages/perl6/site/lib/Sandbox/
cp -p blib/lib/Sandbox/Sclass.pm
/home/kamil/rakudo/install/languages/perl6/site/lib/Sandbox/Sclass.pm
cp -p blib/lib/Sandbox/Sclass.moarvm
/home/kamil/rakudo/install/languages/perl6/site/lib/Sandbox/Sclass.moarvm
mkdir -p /home/kamil/rakudo/install/languages/perl6/site/lib/Sandbox/
cp -p blib/lib/Sandbox/Sclassb.pm
/home/kamil/rakudo/install/languages/perl6/site/lib/Sandbox/Sclassb.pm
cp -p blib/lib/Sandbox/Sclassb.moarvm
/home/kamil/rakudo/install/languages/perl6/site/lib/Sandbox/Sclassb.moarvm
kamil@perl6:~/dev/sandbox$ perl6 fail.pl
===SORRY!===
STable conflict detected during deserialization.
(Probable attempt to load two modules that cannot be loaded together).
kamil@perl6:~/dev/sandbox$ perl6 notfail.pl
kamil@perl6:~/dev/sandbox$

-- 
Pozdrawiam

Kamil Kułaga


Unusual use of x string repetition operator

2014-02-10 Thread Kamil Kułaga
Hi,

I've played wit x and xx repetition operators and found interesting result using
rakudo star:

 join(|, (1,2) x 10)
1 21 21 21 21 21 21 21 21 21 2

Is this ok? If true please explain this to me :) Because I
expected 12121212121212121212 or 12|12|12|12|12|12|12|12|12|12

PS. perl6 --version
This is perl6 version 2014.01 built on parrot 5.9.0 revision 0

--
Regards

Kamil Kułaga


Re: Unusual use of x string repetition operator

2014-02-10 Thread Kamil Kułaga
Hi,

Array stringification to 1 2 mislead me that something more
complicated comes around.

Thanks for fast reply

On Mon, Feb 10, 2014 at 2:29 PM, Tobias Leich em...@froggs.de wrote:
 Hi
 Am 10.02.2014 14:19, schrieb Kamil Kułaga:
 Hi,

 I've played wit x and xx repetition operators and found interesting result 
 using
 rakudo star:

 join(|, (1,2) x 10)
 1 21 21 21 21 21 21 21 21 21 2

 Is this ok? If true please explain this to me :) Because I
 expected 12121212121212121212 or 12|12|12|12|12|12|12|12|12|12
 FROGGS p: say (1,2).Str
 camelia rakudo-parrot 46234b: OUTPUT«1 2␤»

 A Parcel stringifies to 1 2. Then you used the string repeatition
 operator x, and I think you want to use the list repeatition operator
 xx instead.
 FROGGS p: say join(|, (1,2) xx 10)
 camelia rakudo-parrot 46234b:
 OUTPUT«1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2␤»

 Then again, you might want to do this instead:
 FROGGS p: say join(|, (1,2).Str xx 10)
 camelia rakudo-parrot 46234b: OUTPUT«1 2|1 2|1 2|1 2|1 2|1 2|1 2|1 2|1
 2|1 2␤»

 PS. perl6 --version
 This is perl6 version 2014.01 built on parrot 5.9.0 revision 0

 --
 Regards

 Kamil Kułaga




-- 
Pozdrawiam

Kamil Kułaga


Re: Unusual use of x string repetition operator

2014-02-10 Thread Kamil Kułaga
Hi,

The best, because it uses object oriented join. I forgot about it.

On Mon, Feb 10, 2014 at 3:23 PM, Tobias Leich em...@froggs.de wrote:
 Hi, what about this?

 FROGGS r: say ((1,2).join xx 10).join('|')
 camelia rakudo-parrot 46234b, rakudo-jvm 46234b, rakudo-moar 46234b:
 OUTPUT«12|12|12|12|12|12|12|12|12|12␤»

 Am 10.02.2014 14:42, schrieb Kamil Kułaga:
 Hi,

 Array stringification to 1 2 mislead me that something more
 complicated comes around.

 Thanks for fast reply

 On Mon, Feb 10, 2014 at 2:29 PM, Tobias Leich em...@froggs.de wrote:
 Hi
 Am 10.02.2014 14:19, schrieb Kamil Kułaga:
 Hi,

 I've played wit x and xx repetition operators and found interesting result 
 using
 rakudo star:

 join(|, (1,2) x 10)
 1 21 21 21 21 21 21 21 21 21 2

 Is this ok? If true please explain this to me :) Because I
 expected 12121212121212121212 or 12|12|12|12|12|12|12|12|12|12
 FROGGS p: say (1,2).Str
 camelia rakudo-parrot 46234b: OUTPUT«1 2␤»

 A Parcel stringifies to 1 2. Then you used the string repeatition
 operator x, and I think you want to use the list repeatition operator
 xx instead.
 FROGGS p: say join(|, (1,2) xx 10)
 camelia rakudo-parrot 46234b:
 OUTPUT«1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2␤»

 Then again, you might want to do this instead:
 FROGGS p: say join(|, (1,2).Str xx 10)
 camelia rakudo-parrot 46234b: OUTPUT«1 2|1 2|1 2|1 2|1 2|1 2|1 2|1 2|1
 2|1 2␤»
 PS. perl6 --version
 This is perl6 version 2014.01 built on parrot 5.9.0 revision 0

 --
 Regards

 Kamil Kułaga






-- 
Pozdrawiam

Kamil Kułaga


Unusual use of x string repetition operator

2014-02-10 Thread Kamil Kułaga
Hi,

I've played wit x and xx operators and found interesting result using
rakudo star:

 join(|, (1,2) x 10)
1 21 21 21 21 21 21 21 21 21 2

Is this expected? If true please explain this to me :) Because I
expected 12121212121212121212 or 12|12|12|12|12|12|12|12|12|12

PS. perl6 --version
This is perl6 version 2014.01 built on parrot 5.9.0 revision 0

-- 
Regards

Kamil Kułaga


Re: [perl #64886] For (1..10000000000) bug

2009-04-21 Thread Kamil Kułaga
I've tried on another machine:
$ ./perl6 -v
This is Rakudo Perl 6, revision 0 built on parrot 1.0.0-devel
for x86_64-linux-gnu-thread-multi.

Copyright 2006-2008, The Perl Foundation.


It eats whole cpu and starts eating memory.


-- 
Pozdrawiam


Re: [perl #58982] Bug -- make per6 unexpected dot

2008-09-19 Thread Kamil Kułaga
After realclean works fine. Sorry

-- 
Pozdrawiam