Re: How do a pe-salt an array inside an object?

2021-07-12 Thread Clifton Wood
@ToddandMargo wrote: Now I understand. You are using Str as a > skip, skip, drop 2, skip, drop 4 > This is a sequential workaround. > Also I was confused as I though Str was only > a type declaration and could be used this way. > What I would like to see is direct access, without the > skips

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
.new( I => @will_become_I_soon ); Hmmm. 1002 ways! or my $CC = AA.new( I => [ flat( Str xx 400, "four hundred", Str xx 2000-400-1, "two thousand" ) ] ); Sweet! Thank you! No use case. I am just in learning mode on the different ways to pre-salt an object on creation.

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
aybe the experts can suggest a better class design. -Tom Hi Tom, I am only trying to write down the various ways to pre-salting an object on creation. In practice, if I can not figure out how to pre-salt in the declaration, I just put what I want into what I want right under the object decla

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Bruce Gray
> On Jul 6, 2021, at 3:10 PM, Tom Browder wrote: > > On Tue, Jul 6, 2021 at 14:53 ToddAndMargo via perl6-users > wrote: > ... > writing out 2000 skips is not practical. > > Todd, why don't you tell us what you're really trying to do, i.e., what is > your use case? Maybe the experts can sug

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Tom Browder
On Tue, Jul 6, 2021 at 14:53 ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: ... > writing out 2000 skips is not practical. Todd, why don't you tell us what you're really trying to do, i.e., what is your use case? Maybe the experts can suggest a better class design. -Tom

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On Tue, Jul 6, 2021 at 10:42 AM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: >> On Tue, Jul 6, 2021 at 9:39 AM ToddAndMargo via perl6-users >> I am confused. >> >> What I am after it pre-salting $CC.I with >> $CC.[0] = "abc" >>

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Fernando Santagata
Hi, for your last question, let's use again what Norman showed you earlier: > class AA { has Str @.I is rw } (AA) > my $CC = AA.new(I => [Str, Str, 'two', Str, 'four']) AA.new(I => Array[Str].new(Str, Str, "two", Str, "four")) > say $CC.I[0] (Str) > say $CC.I[2] two > say $CC.I[4] four In this ca

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On Tue, Jul 6, 2021 at 9:39 AM ToddAndMargo via perl6-users I am confused. What I am after it pre-salting $CC.I with $CC.[0] = "abc" $CC.[1] = "def" with the ".new" functions when I create $CC -T On 7/6/21 12:52 AM, Fernando Santagata wrote: Hello, I thin

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread Fernando Santagata
27;a' AA.new(I => Array[Str].new("a")) > $bb.I[0] a On Tue, Jul 6, 2021 at 9:39 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > >> On Tue, 6 Jul 2021 at 10:55, ToddAndMargo via perl6-users > >> mailto:perl6-us...@perl.org>&g

Re: How do a pe-salt an array inside an object?

2021-07-06 Thread ToddAndMargo via perl6-users
On Tue, 6 Jul 2021 at 10:55, ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, On creation, I would like to salt some of the values inside an object when the variable inside is an array: First a concept test: $ p6 'class AA { has St

Re: How do a pe-salt an array inside an object?

2021-07-05 Thread Norman Gaywood
y[Str].new(Str, "abc")) > say $CC.I; [(Str) abc] > say $CC.I[1]; abc > $CC.I[0] = "zyz"; zyz > say $CC.I; [zyz abc] > On Tue, 6 Jul 2021 at 10:55, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > On creation, I woul

How do a pe-salt an array inside an object?

2021-07-05 Thread ToddAndMargo via perl6-users
Hi All, On creation, I would like to salt some of the values inside an object when the variable inside is an array: First a concept test: $ p6 'class AA { has Str @.I is rw; }; my $CC= AA.new; $CC.I[1] = "def"; say $CC.I[1];' def Now for the pre-salt test $ p6 '

Re: How do I address individual elements inside an object

2020-12-19 Thread ToddAndMargo via perl6-users
On 12/19/20 4:49 PM, Brad Gilbert wrote: You can interpolate a method call in a string, but you need the parens.     say "$FruitStand.location() has $FruitStand.apples() apples in stock"; Cool! Now four ways of doing it: print $FruitStand.location ~ "has " ~ $FruitStand.apples ~" app

Re: How do I address individual elements inside an object

2020-12-19 Thread Brad Gilbert
hels via perl6-users wrote: >> > Hi Laurent, I get: >> > >> > Fruitstand in Fruit<140431957910656>.location has >> > Fruit<140431957910656>.apples apples. >> > >> > [Rakudo v2020.10] >> > >> > Best, Bill. >> >

Re: How do I address individual elements inside an object

2020-12-19 Thread ToddAndMargo via perl6-users
apples."; Is the "." at the end of the apples literal or syntax?

Re: How do I address individual elements inside an object

2020-12-19 Thread William Michels via perl6-users
> >> > Fruitstand in Fruit<140431957910656>.location has >> > Fruit<140431957910656>.apples apples. >> > >> > [Rakudo v2020.10] >> > >> > Best, Bill. >> > >> >> Hi Bill, >> >> From my notes in progr

Re: How do I address individual elements inside an object

2020-12-19 Thread Laurent Rosenfeld via perl6-users
> Fruit<140431957910656>.apples apples. > > > > [Rakudo v2020.10] > > > > Best, Bill. > > > > Hi Bill, > > From my notes in progress: > > -T > > > *** addressing values inside and object *** > > Reading: >say $

Re: How do I address individual elements inside an object

2020-12-18 Thread ToddAndMargo via perl6-users
On 12/18/20 9:42 AM, William Michels via perl6-users wrote: Hi Laurent, I get: Fruitstand in Fruit<140431957910656>.location has  Fruit<140431957910656>.apples apples. [Rakudo v2020.10] Best, Bill. Hi Bill, From my notes in progress: -T *** addressing values insid

Re: How do I address individual elements inside an object

2020-12-18 Thread William Michels via perl6-users
a class is a blueprint for manufacturing objects, you can > construct as many object as you want. > > 2. As an example, you can try: > > say " Fruitstand in $FruitStand.location has $FruitStand.apples apples."; > > 2. As you declared your class the object attributes will not

Re: How do I address individual elements inside an object

2020-12-18 Thread Parrot Raiser
er Fruit) in $banana.colour would output "green". ($banana.ripen would be a method defined in the class to change "green" to "yellow" and "yellow" to "brown". On 12/18/20, Laurent Rosenfeld via perl6-users wrote: > Hi Todd, > > 1. Ye

Re: How do I address individual elements inside an object

2020-12-18 Thread Laurent Rosenfeld via perl6-users
Hi Todd, 1. Yes, a class is a blueprint for manufacturing objects, you can construct as many object as you want. 2. As an example, you can try: say " Fruitstand in $FruitStand.location has $FruitStand.apples apples."; 2. As you declared your class the object attributes will not

How do I address individual elements inside an object

2020-12-17 Thread ToddAndMargo via perl6-users
oranges => 200, bananas => 50 ); 1) am I correct that I can make as many objects as I want out of a particular class? 2 ) what is the syntax to read an element inside an object? 3) what is the syntax to write to an element inside an object? I am confused, again. -T

Re: Cannot invoke this object (REPR: Null; VMNull)

2019-12-15 Thread Vadim Belman
$!pre-compiled.perl.say; > } > } > > > # File: test.pl6 > --- > use lib ; > use A; > > my A $x .= new; > $x.test; > > > % ./test.pl6 > Cannot invoke this object (REPR: Null; VMNull) > in block at /

Re: Cannot invoke this object (REPR: Null; VMNull)

2019-12-14 Thread Simon Proctor
}) > }) > }; > > method test { > $!pre-compiled.perl.say; > } > } > > > # File: test.pl6 > --- > use lib ; > use A; > > my A $x .= new;

Cannot invoke this object (REPR: Null; VMNull)

2019-12-14 Thread Paul Procacci
}; method test { $!pre-compiled.perl.say; } } # File: test.pl6 --- use lib ; use A; my A $x .= new; $x.test; % ./test.pl6 Cannot invoke this object (REPR: Null; VMNull) in block at /git-repos/test/lib/Loader.pm6 (Loader) line 31 in

Re: Checking If a certain object is present in Array

2019-08-15 Thread Mikkel
ertainly a simple way. >> But this checks for the value of True rather than the object type Bool >> right? What if I wanted to know if an Int, (with any given value) were >> among the values? >> >> Best regards >> Mikkel >> >> On Thu, 15 Aug 2019 at

Re: Checking If a certain object is present in Array

2019-08-15 Thread Simon Proctor
Oh. That's easy use an any junction. say any(@objects) ~~ Bool; On Thu, 15 Aug 2019 at 16:10, Mikkel wrote: > Hi Simon > > That was certainly a simple way. > But this checks for the value of True rather than the object type Bool > right? What if I wanted to know if an

Re: Checking If a certain object is present in Array

2019-08-15 Thread yary
Isn't that a smart match on a type object? > say @objects.any ~~ Bool True > say @objects.any ~~ Rat False -y -y On Thu, Aug 15, 2019 at 8:11 AM Mikkel wrote: > > Hi Simon > > That was certainly a simple way. > But this checks for the value of True rather than

Re: Checking If a certain object is present in Array

2019-08-15 Thread Mikkel
Hi Simon That was certainly a simple way. But this checks for the value of True rather than the object type Bool right? What if I wanted to know if an Int, (with any given value) were among the values? Best regards Mikkel On Thu, 15 Aug 2019 at 16:38, Simon Proctor wrote: > The easiest opt

Re: Checking If a certain object is present in Array

2019-08-15 Thread Simon Proctor
@objects = [1, True, "string", 5, Str.new]; > Containing different kind of objects. It could be Ints, Strs and Bools. > Is there a nice way of determining if for example a Bool is present in the > array, returning True or False whether the given object is present or not? >

Checking If a certain object is present in Array

2019-08-15 Thread Mikkel
se whether the given object is present or not? Best Regards Mikkel Birkedam

Re: Naming a module that deals with the meta-object protocol

2019-04-09 Thread Ralph Mellor
Aiui the most salient feature of your new type is being syntax sugar for conveniently creating and naming a sum type that includes `Failure`, i.e. instead of: my $foo where Int | Failure; $foo = 42; $foo = Failure; $foo = 'nope'; # Type check failed in assignment to $foo; expected

Re: Naming a module that deals with the meta-object protocol

2019-04-08 Thread Vadim Belman
Not sure what you mean by 'leaking into CORE', but I wouldn't use Metamodel:: namespace too. My suggestion would be to use Type::SumHOW or Type::Metamodel::SumHOW. The latter is better from namespace structuring point of view unless long names disgust you. Best regards, Vadim Belman > On Apr 8

Naming a module that deals with the meta-object protocol

2019-04-08 Thread Ben Davies
I wrote a small sum type module that subclasses Perl6::Metamodel::SubsetHOW. I was thinking of naming it either Type::Sum or Metamodel::SumHOW, but Type::Sum doesn't follow the style Rakudo uses for naming MOP classes, and Metamodel::SumHOW may not be a good name because it'd leak the module in

[perl #131623] [BUG] Range + detached method + map with &sub = "Cannot find method 'count' on object of type NQPMu"

2018-04-07 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
> m: ^2 .map: &say > > rakudo-moar 86e7b2: OUTPUT: «===SORRY!===␤Cannot find method > > 'count' on object of type NQPMu␤» > > Fixed with commit > https://github.com/rakudo/rakudo/commit/f3efe5e6b4a9ee59f71ca11cb90ef78539be45e3

[perl #131887] [BUG] method freeze(Pair:D:) changes object identity

2018-03-13 Thread Jan-Olof Hendig via RT
pair.value = 1; $pair; > > number => 1 > > > > Method freeze make the value of the Pair read-only, by removing it > > from its > > Scalar container, and returns the value. > > > >> $pair.freeze; > > 1 > >> $pair.value = 2; > >

[perl #122137] Type object seem to bind in item or push

2018-03-12 Thread Jan-Olof Hendig via RT
On Mon, 18 Sep 2017 13:52:21 -0700, b...@abrij.org wrote: > On Thu, 19 Jun 2014 17:45:23 -0700, elizabeth wrote: > > Additional finds: > > > > [19:24:52] m: my @a; my $c = 1; @a.push: $($c,1); $c = > > "hi"; @a.push: $($c,2); say @a.perl > > [19:24:53] <+camelia>rakudo-moar 8812ca: OUTPUT«

[perl #131623] [BUG] Range + detached method + map with &sub = "Cannot find method 'count' on object of type NQPMu"

2018-03-10 Thread Jan-Olof Hendig via RT
t explodes if you try to both detache and use the &sub map: > m: ^2 .map: &say > rakudo-moar 86e7b2: OUTPUT: «===SORRY!===␤Cannot find method > 'count' on object of type NQPMu␤» Fixed with commit https://github.com/rakudo/rakudo/commit/f3efe5e6b4a9ee59f71ca11cb90ef78539be45e3

[perl #129912] [OPTIMIZER] Subset produces Cannot invoke this object (REPR: Null; VMNull)

2018-03-07 Thread Zoffix Znet via RT
On Wed, 14 Dec 2016 15:14:27 -0800, c...@zoffix.com wrote: > Seems an optimizer bug. Running with --optimize=off does not have the > issue present. Fixed and tested as https://github.com/rakudo/rakudo/issues/1465

[perl #129912] [OPTIMIZER] Subset produces Cannot invoke this object (REPR: Null; VMNull)

2018-03-07 Thread Zoffix Znet via RT
On Wed, 14 Dec 2016 15:14:27 -0800, c...@zoffix.com wrote: > Seems an optimizer bug. Running with --optimize=off does not have the > issue present. Fixed and tested as https://github.com/rakudo/rakudo/issues/1465

[perl #131508] [BUG] `state` with % is Sethash in whenever block ends up with a type object on second iteration

2018-03-06 Thread Zoffix Znet via RT
uot;foo")␤SetHash.new("foo")␤SetHash.new("foo")␤» > > On second iteration ends up being a type object: > > m: react whenever Supply.interval(.3) { state %goods is > SetHash; $++ > 3 and done; dd %goods; %goods++; } > rakudo-moar 3755c0: OUTPUT: «SetHash.new()␤Se

[perl #131508] [BUG] `state` with % is Sethash in whenever block ends up with a type object on second iteration

2018-03-06 Thread Zoffix Znet via RT
uot;foo")␤SetHash.new("foo")␤SetHash.new("foo")␤» > > On second iteration ends up being a type object: > > m: react whenever Supply.interval(.3) { state %goods is > SetHash; $++ > 3 and done; dd %goods; %goods++; } > rakudo-moar 3755c0: OUTPUT: «SetHash.new()␤Se

[perl #128710] combining :D, a where clause and Nil results in empty type object

2018-01-19 Thread Zoffix Znet via RT
r to it's default. > # That default is undefined, what can't work with $_.defined and should > # work (by design, not my opinion) with :D. > # Either way, I would like to get a type object when asking for WHAT. > # may be related to RT#127958 Thanks for the report. It's

[perl #128710] combining :D, a where clause and Nil results in empty type object

2018-01-19 Thread Zoffix Znet via RT
r to it's default. > # That default is undefined, what can't work with $_.defined and should > # work (by design, not my opinion) with :D. > # Either way, I would like to get a type object when asking for WHAT. > # may be related to RT#127958 Thanks for the report. It's

[perl #132694] [JVM] Coercion type Str(Any) returned from .keyof is not the same object as Str(Any)

2018-01-08 Thread via RT
ash is not the same object as Str(Any): $ ./perl6-j -e 'use nqp; say nqp::eqaddr(Str(Any), {"a"=>1}.keyof)' 0 $ ./perl6-m -e 'use nqp; say nqp::eqaddr(Str(Any), {"a"=>1}.keyof)' 1 That's why some tests in S09-typed-arrays/hashes.t and S32-hash/

[perl #117421] [BUG] Typing with ::SomeClass instead of SomeClass in 'has' declaration causes the wrong type object to end up in that attribute in Rakudo

2017-12-03 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
Still reproducible (2017.11,HEAD(e5b660e)) On 2013-03-30 16:55:04, masak wrote: > r: class A { has ::B $.b }; class B {}; print B.new; print > A.new.b.new > rakudo ba5e04: OUTPUT«B<-905822265>No such method 'new' for > invocant of type 'B'␤ in block at /tmp/TluLYMLqwz:1␤␤» > masak: ^^ hmm > th

[perl #124341] Proxy object also works on non- "is rw" subs/methods

2017-12-02 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
What is this thing about? Was there a code snippet that got lost? On 2015-04-18 10:16:32, elizabeth wrote: > [19:13:51] if nothing else it showed that a Proxy leaks > through a not-is-rw method > [19:13:55] _mg_ (~anonymous@95.88.244.237) left IRC. (Client > Quit) > [19:13:57] Yes, that's a bug.

[perl #121154] [BUG] Int type object is much stricter with infix:<%> than Any in Rakudo

2017-12-02 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
tance, but a type object was passed [...] > ..rakudo-jvm 4a74e7: OUTPUT«(Odd)␤Cannot look up attributes > in a type object [...] > ..rakudo-moar 4a74e7: OUTPUT«(Odd)␤Invocant requires an > instance, but a type object was passed [...] > huh. > r: my Int $i; say $i % 2 > ra

[perl #124434] [BUG] Passing an Exception object to Failure.new segfaults (SEGV) in sink context in Rakudo

2017-12-01 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
Heh, this behavior lives its own life. See https://gist.github.com/Whateverable/df882a7545b2aa4cd0575909934f4c48 Since 2017.07 it is producing this message: Died with Exception Actually thrown at: in block at /tmp/m_9jvp4WTp line 1 I think that's reasonable. Marking as 「testneeded」. On 2015-

Re: [perl #132236] Possible regression in Meta object construction

2017-10-10 Thread Elizabeth Mattijsen via RT
ception -I. -e 'use Suptest; class Bar {}' > > This gives rise to: > > Cannot find method 'EXPORTHOW::SUPERSEDE::class' on object of type > EXPORTHOW::SUPERSEDE::class > at gen/moar/BOOTSTRAP.nqp:3009 > (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/l

Re: [perl #132236] Possible regression in Meta object construction

2017-10-10 Thread Elizabeth Mattijsen
ception -I. -e 'use Suptest; class Bar {}' > > This gives rise to: > > Cannot find method 'EXPORTHOW::SUPERSEDE::class' on object of type > EXPORTHOW::SUPERSEDE::class > at gen/moar/BOOTSTRAP.nqp:3009 > (/home/jonathan/.rakudobrew/moar-nom/install/share/nqp/l

Re: [perl #132246] .pick and .roll return incorrect results for object hashes

2017-10-08 Thread Elizabeth Mattijsen via RT
t;> use Test; > Nil; >> my %str = question => 42; > {question => 42} >> is %str.pick, %str.pairs.pick; > ok 1 - > True >> is %str.roll, %str.pairs.roll; > ok 2 - > True > > But these methods appear to be unaware of the object hash abstraction: &

Re: [perl #132246] .pick and .roll return incorrect results for object hashes

2017-10-08 Thread Elizabeth Mattijsen
t;> use Test; > Nil; >> my %str = question => 42; > {question => 42} >> is %str.pick, %str.pairs.pick; > ok 1 - > True >> is %str.roll, %str.pairs.roll; > ok 2 - > True > > But these methods appear to be unaware of the object hash abstraction: &

[perl #132246] .pick and .roll return incorrect results for object hashes

2017-10-08 Thread via RT
to be unaware of the object hash abstraction: > my %obj{Any} = question => 42; {question => 42} > is %obj.pick, %obj.pairs.pick; not ok 3 - # Failed test at line 1 # expected: 'question 42' # got: 'Str|question question42' False > is %obj.rol

[perl #132236] Possible regression in Meta object construction

2017-10-07 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
W { > has $.foo; > } > } > > > Which is exercised with: > > perl6 --ll-exception -I. -e 'use Suptest; class Bar {}' > > This gives rise to: > > Cannot find method 'EXPORTHOW::SUPERSEDE::class' on object of type > EXPORTHOW::SUPERSEDE::clas

[perl #132236] Possible regression in Meta object construction

2017-10-07 Thread via RT
is Metamodel::ClassHOW { has $.foo; } } Which is exercised with: perl6 --ll-exception -I. -e 'use Suptest; class Bar {}' This gives rise to: Cannot find method 'EXPORTHOW::SUPERSEDE::class' on object of type EXPORTHOW::SUPERSEDE::class at gen/

RE: Perl 6 Object Construction - General Advice

2017-10-05 Thread Mark Devine
s. If I can get new() to load up all attributes, then there will be no need for a clunky new()->my-more-complete-init() in my classes. Hundreds of classes… Perl 6 provides a comprehensive simplest-case for Object Construction (OC) when only attributes are specified -- defaults &

RE: Perl 6 Object Construction - General Advice

2017-10-05 Thread Mark Devine
ssage- From: Timo Paulssen [mailto:t...@wakelift.de] Sent: Thursday, October 5, 2017 13:56 To: Mark Devine ; perl6-us...@perl.org Subject: Re: Perl 6 Object Construction - General Advice The main difference between BUILD and TWEAK is that BUILD will replace all default and requiredness handling,

Re: Perl 6 Object Construction - General Advice

2017-10-05 Thread Timo Paulssen
The main difference between BUILD and TWEAK is that BUILD will replace all default and requiredness handling, while TWEAK keeps it intact. TWEAK gets run after these aspects had their turn, so if you have an "is required" attribute that doesn't get a value passed, the BUILDALL process will throw th

[perl #130186] Match object inside .comb is weird (‘789’.comb(/ . {say $/} /))

2017-10-02 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
This was fixed during the uncurse merge. Bisect log (20 candidates): https://gist.github.com/7cedc2e2e35913544f75bc5fc89bd088 「testneeded」 On 2016-11-26 18:36:35, alex.jakime...@gmail.com wrote: > *Code:* > dd ‘789’.comb(/ . {say $/} /)' > > *Result:* > 「7」 > 「7」 > 「7」 > slip() > > It may seem l

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Daniel Schröer
r difficulties indicate that you should rethink your design. I believe that in the common case you should be able to do with the basic standard ways of object construction. Maybe parsing that input should be someone else's job, not that of the constructors.

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
new is there is no sane way to inherit them from superclasses or make them usable from subclasses without baking them into the entire object hierarchy. They make sense only for things like what Java calls final classes, and even then probably only for atomic value types (e.g. things like Int where th

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Timo Paulssen
I wrote another more in-depth (but potentially less useful to you) mail about this further down the thread, but I thought it'd be good to point this out near the top: I think the /self.bless(|%args)!initialize/ idiom is a work-around for /submethod TWEAK/ not yet existing when this code was writte

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Timo Paulssen
Here's the internal details of the guts: BUILDALL has so far been sort of an interpreter for something called the "buildplan". When a class gets composed (usually what happens immediately when the parser sees the closing } of the class definition) all attributes are considered along with their def

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread Brandon Allbery
On Sun, Oct 1, 2017 at 1:02 PM, yary wrote: > > I hadn't heard of TWEAK, thought that BUILD was for setting private > attributes and other tasks the object runs to build itself. > IIRC having BUILD overrides default values, so if you want to have those and still adjust

Re: Perl 6 Object Construction - General Advice

2017-10-01 Thread yary
I barely write any p6 but my impression was to avoid bless, and stick with using named arguments for object creation. Using positional parameters forces creating a "method new ..." I hadn't heard of TWEAK, thought that BUILD was for setting private attributes and other tasks the

Re: Perl 6 Object Construction - General Advice

2017-09-30 Thread Brian Duggan
On Saturday, September 30, Mark Devine wrote: > My most common OC case: initialize attributes at OC time from external > input that will be parsed with grammars &/| scrubbed with elaborate > conditional tests. I like to use assignment for simple things and TWEAK for complicated things -- cl

Perl 6 Object Construction - General Advice

2017-09-30 Thread Mark Devine
Perl 6, I am preparing to write several classes for some Perl 6 apps I intend to craft in support of a prominent backup suite. In looking at the documentation & some of the modules published in the Perl 6 ecosystem, I’m not quite sure that I can identify the best idiomatic object construc

Re: write bytes requires an object with REPR MVMOSHandle

2017-09-29 Thread ToddAndMargo
uot;key = <$key>  value =<$value>\n" );     if    ( $key eq "to" )   { $SmtpHandle.print( "$key=     #delimiter is a comma\n" ); }     elsif ( $key eq "FileName" ) { $SmtpHandle.print( "$key=     #delimiter is a comma\n" );

Re: write bytes requires an object with REPR MVMOSHandle

2017-09-29 Thread ToddAndMargo
t;\n" ); if( $key eq "to" ) { $SmtpHandle.print( "$key= #delimiter is a comma\n" ); } elsif ( $key eq "FileName" ) { $SmtpHandle.print( "$key= #delimiter is a comma\n" ); } else { $SmtpHandl

Re: write bytes requires an object with REPR MVMOSHandle

2017-09-29 Thread Andy Bach
PrintGreen ( "key = <$key> value =<$value>\n" ); >if( $key eq "to" ) { $SmtpHandle.print( "$key= > #delimiter is a comma\n" ); } >elsif ( $key eq "FileName" ) { $SmtpHandle.print( "$key= #delim

write bytes requires an object with REPR MVMOSHandle

2017-09-28 Thread ToddAndMargo
space after the = sign. \n" ); $SmtpHandle.print( "#\n" ); for %SmtpIni.kv -> $key, $value { PrintGreen ( "key = <$key> value =<$value>\n" ); if( $key eq "to" ) { $SmtpHandle.print( "$key= #delimi

[perl #132073] [BUG] isa method errors when called on a subset type object

2017-09-20 Thread David Warring via RT
Final issues resolved with https://github.com/rakudo/rakudo/commit/cee1be22cff6153506e31df2916f8a0be27b5fc8 On Sat, 16 Sep 2017 12:12:35 -0700, david.warring wrote: > Tests added with roast commit > https://github.com/perl6/roast/commit/d776a06e52c35d6cbb7b7bbade7b7a15b97ecff8 > > One remaining

[perl #122137] Type object seem to bind in item or push

2017-09-18 Thread Brian S. Julin via RT
On Thu, 19 Jun 2014 17:45:23 -0700, elizabeth wrote: > Additional finds: > > [19:24:52] m: my @a; my $c = 1; @a.push: $($c,1); $c = > "hi"; @a.push: $($c,2); say @a.perl > [19:24:53] <+camelia>rakudo-moar 8812ca: OUTPUT«Array.new($("hi", > 1), $("hi", 2))␤» > [19:25:09] it would appear

Re: [perl #132073] [BUG] isa method errors when called on a subset type object

2017-09-16 Thread David Warring via RT
Tests added with roast commit https://github.com/perl6/roast/commit/d776a06e52c35d6cbb7b7bbade7b7a15b97ecff8 One remaining todo test for the subset of a subset case, ie: subset S of Int; subset S2 of S; say S2.isa(S) On Sun, Sep 17, 2017 at 6:34 AM, David Warring wrote: > After that commit: su

Re: [perl #132073] [BUG] isa method errors when called on a subset type object

2017-09-16 Thread David Warring
Tests added with roast commit https://github.com/perl6/roast/commit/d776a06e52c35d6cbb7b7bbade7b7a15b97ecff8 One remaining todo test for the subset of a subset case, ie: subset S of Int; subset S2 of S; say S2.isa(S) On Sun, Sep 17, 2017 at 6:34 AM, David Warring wrote: > After that commit: su

Re: [perl #132073] [BUG] isa method errors when called on a subset type object

2017-09-16 Thread David Warring
After that commit: subset S of Int; S.isa(True) returns true as expected. I've noticed a quibble with subset of a subset: perl6 -e'subset S of Int; subset S2 of S; say S2.isa(S)' False Should be True. On Sun, Sep 17, 2017 at 3:17 AM, Aleks-Daniel Jakimenko-Aleksejev via RT < perl6-bugs-follo...

Re: [perl #132073] [BUG] isa method errors when called on a subset type object

2017-09-16 Thread David Warring via RT
After that commit: subset S of Int; S.isa(True) returns true as expected. I've noticed a quibble with subset of a subset: perl6 -e'subset S of Int; subset S2 of S; say S2.isa(S)' False Should be True. On Sun, Sep 17, 2017 at 3:17 AM, Aleks-Daniel Jakimenko-Aleksejev via RT < perl6-bugs-follo...

[perl #132073] [BUG] isa method errors when called on a subset type object

2017-09-16 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
What about this commit? https://github.com/rakudo/rakudo/commit/0704cd97226e6300194342c88cef1c5fe711 On 2017-09-12 13:55:51, david.warring wrote: > current behavior of isa method on a subset: > > % perl6 -v > This is Rakudo version 2017.08-110-g5f3350656 built on MoarVM version > 2017.08.1-156

[perl #132073] [BUG] isa method errors when called on a subset type object

2017-09-12 Thread via RT
# New Ticket Created by David Warring # Please include the string: [perl #132073] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=132073 > current behavior of isa method on a subset: % perl6 -v This is Rakudo version 2017.08-1

[perl #132051] [BUG] Parametric type object passed as literal die with error

2017-09-10 Thread via RT
# New Ticket Created by Vittore Scolari # Please include the string: [perl #132051] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=132051 > The following script role DataNo { method Blob() { my \T = uint8;

[perl #132051] [BUG] Parametric type object passed as literal die with error

2017-09-10 Thread Sam S. via RT
Although that particular error message seems to be specific to `Blob`, it also breaks with other parametric roles (such as `Array`), because the generic parameter T of the outer role seems to be passed through without being specialized first. Shorter examples: ➜ role R[::T] { method a { A

[perl #130602] [BUG] `1, 2 Xand "ab".ords` fails with "Cannot invoke this object (REPR: Uninstantiable; Callable)"

2017-08-26 Thread Sam S. via RT
This bug is still present in Rakudo version 2017.08-8-g753c9a5ea built on MoarVM version 2017.08.1-19-g151a2563 implementing Perl 6.c.

[perl #131947] [OO] Using a role parameter to constrain an uninitialized attribute, leaks a generic type object.

2017-08-22 Thread via RT
But remove the explicit initializer `= T` (which should be redundant, right?), and it blows up: ‎‎➜ role R [::T] { has T $.a }; say R[Int].new.a; ‎‎No such method 'gist' for invocant of type 'T' ‎‎ in block at line 1 Looks like the automatic initializer for `$.a`

[perl #131925] Smartmatching a junction against a regex object vs m// (‘a’|‘b’ ~~ m/‘a’/)

2017-08-19 Thread Sam S. via RT
The problem only appears if `m//` is used directly as the RHS of `~~`: $_ = 'a' | 'b'; say m/a/; # any(「a」, Nil) say $_ ~~ m/a/; # False say $_ ~~ { m/a/ }; # any(「a」, Nil)

[perl #131925] Smartmatching a junction against a regex object vs m// (‘a’|‘b’ ~~ m/‘a’/)

2017-08-18 Thread via RT
# New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev # Please include the string: [perl #131925] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=131925 > Code: say so $*DISTRO.Str|$*KERNEL.Str ~~ /linux/ Result: True Cod

Re: [perl #131887] [BUG] method freeze(Pair:D:) changes object identity

2017-08-13 Thread Elizabeth Mattijsen
, and returns the value. > >> $pair.freeze; >1 >> $pair.value = 2; >Cannot modify an immutable Int (1) > in block at line 1 > > The problem is that freeze does more than that. It changes the object > identity as returned by WHICH as well: > >&g

Re: [perl #131887] [BUG] method freeze(Pair:D:) changes object identity

2017-08-13 Thread Elizabeth Mattijsen via RT
, and returns the value. > >> $pair.freeze; >1 >> $pair.value = 2; >Cannot modify an immutable Int (1) > in block at line 1 > > The problem is that freeze does more than that. It changes the object > identity as returned by WHICH as well: > >&g

[perl #131887] [BUG] method freeze(Pair:D:) changes object identity

2017-08-12 Thread via RT
, by removing it from its Scalar container, and returns the value. > $pair.freeze; 1 > $pair.value = 2; Cannot modify an immutable Int (1) in block at line 1 The problem is that freeze does more than that. It changes the object identity as returned by WHICH as

Re: [perl #127858] [BUG] "Cannot invoke this object" error while importing an array constant

2017-07-26 Thread Lloyd Fournier
the subject line of all future correspondence about this issue. > > # https://rt.perl.org/Ticket/Display.html?id=127858 > > > > > > > $ cat > A.pm6 > > unit module A; > > > > constant @a is export = map { (1 +< $_) => 1 }, ^3; > > > &g

Re: [perl #127858] [BUG] "Cannot invoke this object" error while importing an array constant

2017-07-26 Thread Lloyd Fournier via RT
the subject line of all future correspondence about this issue. > > # https://rt.perl.org/Ticket/Display.html?id=127858 > > > > > > > $ cat > A.pm6 > > unit module A; > > > > constant @a is export = map { (1 +< $_) => 1 }, ^3; > > > &g

Re: [perl #127858] [BUG] "Cannot invoke this object" error while importing an array constant

2017-07-25 Thread Lloyd Fournier via RT
IB=. perl6 -e 'use A; say @a[1];' > Cannot invoke this object > in block at /home/grondilu/A.pm6 (A) line 3 > in block at -e line 1 > > $ perl6 -e 'module A { constant @a is export = map { (1 +< $_) => 1 }, ^3; > }; import A; say @a[1];' > 2 => 1

Re: [perl #127858] [BUG] "Cannot invoke this object" error while importing an array constant

2017-07-25 Thread Lloyd Fournier
IB=. perl6 -e 'use A; say @a[1];' > Cannot invoke this object > in block at /home/grondilu/A.pm6 (A) line 3 > in block at -e line 1 > > $ perl6 -e 'module A { constant @a is export = map { (1 +< $_) => 1 }, ^3; > }; import A; say @a[1];' > 2 => 1

[perl #131776] perl6-debug-m can't setlang on object of type Perl6::HookGrammar

2017-07-21 Thread Zoffix Znet via RT
On Fri, 21 Jul 2017 07:30:38 -0700, comdog wrote: > When I run perl6-debug-m from the Rakudo Star, I get this error: > > $ perl6-debug-m test.p6 > Cannot find method 'setlang' on object of type Perl6::HookGrammar >at gen/moar/perl6-debug.nqp:407 > (/Application

[perl #131776] perl6-debug-m can't setlang on object of type Perl6::HookGrammar

2017-07-21 Thread Zoffix Znet via RT
On Fri, 21 Jul 2017 07:30:38 -0700, comdog wrote: > When I run perl6-debug-m from the Rakudo Star, I get this error: > > $ perl6-debug-m test.p6 > Cannot find method 'setlang' on object of type Perl6::HookGrammar >at gen/moar/perl6-debug.nqp:407 > (/Application

Re: [perl #131776] perl6-debug-m can't setlang on object of type Perl6::HookGrammar

2017-07-21 Thread Timo Paulssen via RT
Already fixed in newer versions

Re: [perl #131776] perl6-debug-m can't setlang on object of type Perl6::HookGrammar

2017-07-21 Thread Timo Paulssen
Already fixed in newer versions

[perl #131776] perl6-debug-m can't setlang on object of type Perl6::HookGrammar

2017-07-21 Thread brian d foy
perl6-debug-m test.p6 Cannot find method 'setlang' on object of type Perl6::HookGrammar at gen/moar/perl6-debug.nqp:407 (/Applications/Rakudo/share/perl6/runtime/perl6-debug.moarvm:comp_unit) from src/Perl6/Grammar.nqp:492 (/Applications/Rakudo/share/nqp/lib/Perl6/Grammar.mo

[perl #131639] [BUG] Junction:D.iterator returns an iterator that .pulls-one a Mu type object

2017-06-23 Thread via RT
# New Ticket Created by Zoffix Znet # Please include the string: [perl #131639] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=131639 > Originally found this in behaviour of Z meta operator: m: dd .any Z .any rakudo

[perl #131623] [BUG] Range + detached method + map with &sub = "Cannot find method 'count' on object of type NQPMu"

2017-06-22 Thread via RT
: *.say rakudo-moar 86e7b2: OUTPUT: «0␤1␤» m: (^2).map: &say rakudo-moar 86e7b2: OUTPUT: «0␤1␤» But explodes if you try to both detache and use the &sub map: m: ^2 .map: &say rakudo-moar 86e7b2: OUTPUT: «===SORRY!===␤Cannot find method 'count' on object of type NQPMu␤»

  1   2   3   4   5   6   7   8   9   10   >