[perl #121940] [@LARRY] say True but False # should be 'True' (advent2010-day19)
The behavious still seems the same: % perl6 --v This is Rakudo version 2016.07.1-135-g77724b2 built on MoarVM version 2016.07-16-g85b6537 implementing Perl 6.c. % perl6 -e'my $s = False but True; say $s; say $s.so;' True True This is inconsistent with: % perl6 -e'my $s = 0 but True; say $s; say $s.so;' 0 True On Tue Aug 09 08:23:37 2016, coke wrote: > On Wed May 21 13:36:58 2014, david.warring wrote: > > [08:09] r: my $value = True but False; say $value > > [08:09] <+camelia> rakudo-jvm 196b4f: OUTPUT«(timeout)» > > [08:09] <+camelia> ..rakudo-{parrot,moar} 196b4f: OUTPUT«False» > > ... > > [08:10] rakudo-jvm is all "WARNING. PARADOX. MUST OVERHEAT." > > [08:11] * dwarring heh > > ... > > [08:11] I'll put in an rakudobug > > ... > > [08:18] dwarring: just be aware, camelia has been known to > > timeout on rakudo-jvm. > > [08:18] dwarring: so it might just be an artifact. > > [08:21] n: my $value = True but False; say $value > > [08:21] <+camelia> niecza v24-109-g48a8de3: OUTPUT«True» > > [08:21] m: my $value = True but False; say $value > > [08:21] <+camelia> rakudo-moar 196b4f: OUTPUT«False» > > [08:21] I guess it is about that > > [08:22] this expects 'True' - > > http://perl6advent.wordpress.com/2010/12/19/day-19-false-truth/ > > [08:24] I kind of expect True, too. > > [08:24] == ajr_ [~quas...@96-44-210-169.ip.tor.radiant.net] has quit > > [Ping timeout: 240 seconds] > > [08:25] r: my $value = True but False; say ?$value > > [08:25] <+camelia> rakudo-{parrot,jvm,moar} 196b4f: OUTPUT«False» > > [08:25] because the *value* is still True, kind of. it's just > > the boolean aspect of it that has been overridden. > > [08:25] n: my $value = True but False; say ?$value > > [08:25] <+camelia> niecza v24-109-g48a8de3: OUTPUT«False» > > [08:25] niecza++ > > This is from an old advent post that was pre-Christmas; is this > actually a bug in current rakudo we should fix, or is the advent post > out of date?
[perl #131174] [NYI] Atrribute Introspect shape
I've added a fudged test to S12-introspection/attributes.t that the container shape is as declared; not a Whatever. On Wed, 19 Apr 2017 03:14:35 -0700, c...@zoffix.com wrote: > On Tue, 18 Apr 2017 20:34:15 -0700, david.warring wrote: > > AFAIK there's currently no way of introspecting the shape of a Class > > attribute that's a native shaped array. > > > > I'd like this feature for the Native::Packing module. For example to > > interpret: > > > > class C { > > has byte @.gif-header[6]; > > has uint16 $.width; > > has uint16 $height; > > } > > > > At the moment, I just can't determine the size of shaped native arrays, > > such as @.gif-header above: > > > > say .type, .container > > for C.^attributes; > > > > (Positional[byte])(array[byte]) > > (uint16)(uint16) > > (uint16)(uint16) > > > Seems .container does have method .shape, but it returns a Whatever: > > class C { > has byte @.gif-header[6]; > has uint16 $.width; > has uint16 $height; > } > say .container.shape for C.^attributes[0]; # (*) > dd C.new.gif-header.shape; # (6,) > > my byte @z[6]; > dd @z.shape; # (6,)
Re: [perl #132073] [BUG] isa method errors when called on a subset type object
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 Warringwrote: > 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.org> wrote: > >> What about this commit? >> https://github.com/rakudo/rakudo/commit/0704cd97226e63001943 >> 42c88cef1c5fe711 >> >> 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-g4 >> > 9b90b99 >> > implementing Perl 6.c. >> > % perl6 -e'subset S of Int; say S.isa(Int)' >> > Cannot resolve caller isa(Perl6::Metamodel::SubsetHOW: S, Int); none of >> > these signatur >> > es match: >> > (Mu \SELF: Mu $type, *%_) >> > (Mu \SELF: Str:D $name, *%_) >> > in block at -e line 1 >> > >> > The documentation https://docs.perl6.org/routine/isa implies this >> should >> > return True. >> >> >
Re: [perl #132073] [BUG] isa method errors when called on a subset type object
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.org> wrote: > What about this commit? > https://github.com/rakudo/rakudo/commit/0704cd97226e6300194342c88c > ef1c5fe711 > > 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-g4 > > 9b90b99 > > implementing Perl 6.c. > > % perl6 -e'subset S of Int; say S.isa(Int)' > > Cannot resolve caller isa(Perl6::Metamodel::SubsetHOW: S, Int); none of > > these signatur > > es match: > > (Mu \SELF: Mu $type, *%_) > > (Mu \SELF: Str:D $name, *%_) > > in block at -e line 1 > > > > The documentation https://docs.perl6.org/routine/isa implies this should > > return True. > >
[perl #132073] [BUG] isa method errors when called on a subset type object
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 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: 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.org> wrote: > > > >> What about this commit? > >> https://github.com/rakudo/rakudo/commit/0704cd97226e63001943 > >> 42c88cef1c5fe711 > >> > >> 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-g4 > >> > 9b90b99 > >> > implementing Perl 6.c. > >> > % perl6 -e'subset S of Int; say S.isa(Int)' > >> > Cannot resolve caller isa(Perl6::Metamodel::SubsetHOW: S, Int); > >> > none of > >> > these signatur > >> > es match: > >> > (Mu \SELF: Mu $type, *%_) > >> > (Mu \SELF: Str:D $name, *%_) > >> > in block at -e line 1 > >> > > >> > The documentation https://docs.perl6.org/routine/isa implies this > >> should > >> > return True. > >> > >> > >
Re: [perl #132222] [BUG] 'HAS' Embedded C-Structs not working as documented
Thanks for that. As a worka-around Rakudo seems to do a better job, if I give it a helping hand viz a TWEAK method: use NativeCall; class Point is repr('CStruct') { has uint8 $.x; has uint8 $.y; } class MyStruct2 is repr('CStruct') { HAS Point $.point; # <-- embedded has int8 $.flags; method TWEAK { $!point := Point.new; } } say .name, ': ', .inlined for MyStruct2.^attributes; my $s = nativecast(MyStruct2, buf8.new: 42,69,11); say $s.flags; say $s.point.defined; say $s.point.x; say $s.point.y; Produces: $!point: 1 $!flags: 0 11 True 42 69 On Fri, Oct 6, 2017 at 5:12 AM, Brian S. Julin via RT < perl6-bugs-follo...@perl.org> wrote: > On Wed, 04 Oct 2017 23:19:19 -0700, david.warring wrote: > > From > > https://docs.perl6.org/language/nativecall#Embedding_ > CStructs_and_CUnions > > > > class Point is repr('CStruct') { > > has uint16 $.x; > > has uint16 $.y; > > } > > > > class MyStruct2 is repr('CStruct') { > > HAS Point $.point; # <-- embedded > > has int32 $.flags; > > } > > > > my $s = MyStruct2.new; > > say $s.flags; > > say $s.point.defined; > > say $s.point.x; > > > > Produces: > > > > 0 > > False > > Cannot look up attributes in a Point type object > > in block at /tmp/tst.pl line 15 > > > > Ie, the embedded struct is not automatically created and defined, when a > > new containing struct is created. > > > > Rakudo version 2017.09-199-gc91c40115 built on MoarVM version > > 2017.09.1-62-g89ca8eb0 > > implementing Perl 6.c. > > > This is more an NYI than a bug... the code for that is more or less > a first-pass draft. There are workarounds (see my xcb module), but they > require surrendering your sanity to dark forces. > >
[perl #128000] [NativeCall] Feature Request: Pointer Arithmetic
On Tue, 26 Apr 2016 15:24:57 -0700, sortiz wrote: > Hi David, > > Can you give a try to NativeHelpers::Pointer, part of NativeHelpers::Blob? > > When well tested I plan push it to core. > > Regards. > > Salvador Ortiz. Hi Salvador, That looks. OK. Can it go straight into core?
Re: [perl #131965] Shaped arrays can't have zero size
Attached is my use case which is parsing of PDF cross reference indices. There are normally three numeric entries per line. e.g. xref 0 8 00 65535 f 09 0 n 74 0 n 000120 0 n Which populates nicely into an array of 'n' lines of shape 3. There's the rare, but possible case of an xref section with zero entries xref 0 0 (I've encountered real-world PDF's like this). The attached grammar/actions attempted to handle it as an array of shape [0;3], but wont work on current Rakudo. Just my preferred solution for the above case. - David On Sun, Aug 27, 2017 at 12:38 PM, Brandon Allbery via RT < perl6-bugs-follo...@perl.org> wrote: > > Well, what do you mean? Of course you can't put anything into it, and any > > attempt to index it will throw. It may seem useless, however, if you can > > have > > an empty array, why can't you have a shaped empty array? > > > > Only if all dimensions are unindexable. Otherwise you have something with > inaccessible slots (and, potentially thereby, not truly leaked but > unusable, memory). > > And an empty unshaped array, in addition to being usable as such > (degenerate case of all shaped dimensions being size 0), can be made > non-empty. Shaped arrays cannot. > > grammar XRef { rule TOP { xref\n+ } rule xref-section
[perl #128000] [NativeCall] Feature Request: Pointer Arithmetic
Thanks Salvador, Now in Rakudo core https://github.com/rakudo/rakudo/commit/3ca6554fdd8ff91da5423e85d4a2b7d309949531 On Tue, 03 Oct 2017 10:41:41 -0700, david.warring wrote: > On Tue, 26 Apr 2016 15:24:57 -0700, sortiz wrote: > > Hi David, > > > > Can you give a try to NativeHelpers::Pointer, part of NativeHelpers::Blob? > > > > When well tested I plan push it to core. > > > > Regards. > > > > Salvador Ortiz. > > Hi Salvador, > That looks. OK. Can it go straight into core?
[perl #131919] [RFC] Returning Failure from failed P6-level .parse
On Mon, 21 Aug 2017 07:38:56 -0700, alex.jakime...@gmail.com wrote: > It was removed completely for 2017.08 release. > > Rakudo commit: > https://github.com/rakudo/rakudo/commit/465d91abdfda038cb7feda35f7966be4ec39acf3 > Discussion: https://irclog.perlgeek.de/perl6-dev/2017-08-21#i_15048995 > On 2017-08-19 15:31:01, alex.jakime...@gmail.com wrote: > > I had to revert one of the nqp commits related to .parse: > > https://github.com/perl6/nqp/commit/d4d77b66c46c57de800b147df61fe486b4486acd > > > > Here's a ticket for the module that was affected by the change: > > https://github.com/p6-css/CSS-Module-p6/issues/10 > > > > Most certainly we want this change back ASAP, but it had to be > > reverted for the > > release. > > > > ♥ > > > > On 2017-08-19 05:36:36, alex.jakime...@gmail.com wrote: > > > The change was moved to v6.d in this commit: > > > > > > https://github.com/rakudo/rakudo/commit/d2278b471cb0bd691dc7a1235fbcb9318ff5d61f > > > > > > On 2017-08-17 08:50:48, alex.jakime...@gmail.com wrote: > > > > See this commit: > > > > > > > > > > https://github.com/rakudo/rakudo/commit/9501edae4f73a970e3270e3b0336a7b3045d3329 > > > > > > > > These roast commits: > > > > * > > > > > > > > > > https://github.com/perl6/roast/commit/1fb68c4b7a7c975f26fc81ad79f000958d1b4afd > > > > * > > > > > > > > > > https://github.com/perl6/roast/commit/b53616f8e67f9b19366008b3abf55400a3d6cd2b > > > > > > > > And this justification: > > > > * https://irclog.perlgeek.de/perl6-dev/2017-08-16#i_15021994 > > > > > > > > This blog post noticing the breakage due to the change: > > > > * https://gfldex.wordpress.com/2017/08/17/parsing-nothing/ > > > > > > > > And these thoughts about postponing it to v6.d: > > > > * https://irclog.perlgeek.de/perl6-dev/2017-08-17#i_15032160 > > > > > > > > > > > > I am confident that we will not be able to process this change > > > > and > > > > all > > > > potential breakage associated with it in ≈3 days before the > > > > release, > > > > so the revert is coming. > > > > > > > > Personally, I don't mind rereverting it afterwards for inclusion > > > > in > > > > 2017.09, assuming we make sure to fix all modules that were > > > > relying > > > > on > > > > Nils being returned. However, I do see the point for postponing > > > > it > > > > till v6.d. > > > > > > > > > > > > So should we feel adventurous and push this change as early as we > > > > can > > > > (in 2017.09, aftear at least one month)? Or is it better to be > > > > safe > > > > and wait for v6.d? Please discuss. I've had a chance to golf this (somewhat) from CSS::Module. The following fails to parse if I revert https://github.com/perl6/nqp/commit/d4d77b66c46c57de800b147df61fe486b4486acd grammar Tst { rule local {:i('local')'(' [ \'\' ] ')'} rule declaration-list { * } rule declarations { '{' '}' } rule test-prop { (src) ':' +% ',' } } say Tst.parse('{ src: local(\'Gentium\') }', :rule )
[perl #131666] NativeCall MoarVM panic
Can confirm this is still current behaviour with Rakudo 2019. I have came across exactly the same issue and found this ticket. I've noticed, If I change the example to catch exceptions. It then runs: sub start-element($, $elem, $attr) { say "open $elem".indent($depth * 4); say $attr.elems; ++$depth; CATCH { default { warn "whoops: $_" } } } Produces: open calendar whoops: Don't know how many elements a C array returned from a library in block at /tmp/tst.p6 line 27 open advent whoops: Don't know how many elements a C array returned from a library in block at /tmp/tst.p6 line 27 ...etc Underlying issue seems to be that any uncaught exception in a NativeCall Perl callback currently results in a unfriendly NativeCall MoarVM panic. The exception itself is lost. On Tue, 27 Jun 2017 05:59:08 -0700, vladimir.ma...@oracle.com wrote: > I took the NativeCall sample from here: > > https://perl6advent.wordpress.com/2015/12/21/day-21-nativecall-backs- > and-beyond-c/ > > > use NativeCall; > > sub XML_SetElementHandler(OpaquePointer $parser, > (OpaquePointer, Str, CArray[Str]), >(OpaquePointer, Str)) > is native('expat') { ... } > > sub XML_ParserCreate(Str --> OpaquePointer) is > native('expat') { ... } > sub XML_ParserFree(OpaquePointer) is > native('expat') { ... } > sub XML_Parse(OpaquePointer, Buf, int32, int32 --> int32) is > native('expat') { ... } > > my $xml = q:to/XML/; > > > > > > XML > > my $depth = 0; > > sub start-element($, $elem, $attr) > { > say "open $elem".indent($depth * 4); > ++$depth; > } > > sub end-element($, $elem) > { > --$depth; > say "close $elem".indent($depth * 4); > } > > my $parser = XML_ParserCreate('UTF-8'); > XML_SetElementHandler($parser, , ); > > my $buf = $xml.encode('UTF-8'); > XML_Parse($parser, $buf, $buf.elems, 1); > > XML_ParserFree($parser); > > > > All works fine, unless I try to use the $attr in start-element > > sub start-element($, $elem, $attr) > { > say "open $elem".indent($depth * 4); > say $attr.elems; > ++$depth; > } > > > The program then terminates with: > > MoarVM panic: Internal error: Unwound entire stack and missed handler > > > I have seen that on Solaris, but Linux has the same issue. In both > cases > custom build perl6 using 'rakudobrew build moar' so I suppose latest > git revision. > > Thank you