Re: Fastest way to convert from a Buf to a Str?

2019-02-03 Thread David Warring
Are all characters in the range 0-255, ie latin-1 characters? You could then try: my $str = $buf.decode("latin-1"); There's one potential issue if your data could contain DOS end of lines ("\r\n"), which will get translated to a single logical "\n" in the decoded string. - David On Sun, Feb

Re: Is LibraryMake still current?

2019-12-22 Thread David Warring
Hi Fernando, I'm still in the habit of using LibraryMake. E.g. for https://github.com/p6-xml/LibXML-raku released in this last few months. Regards, David On Sun, Dec 22, 2019 at 7:47 AM Fernando Santagata < nando.santag...@gmail.com> wrote: > Hello, > > What can I use to help building native code

Re: ^methods doesn't show all methods

2021-02-16 Thread David Warring
I'm getting this on Rakudo blead. $ raku -v Welcome to Rakudo(tm) v2020.12-129-g291cc5f39. Implementing the Raku(tm) programming language v6.d. Built on MoarVM version 2020.12-100-gc93531608. $ raku -e'my $s = set 2, 4, 6; say $s.^methods>>.name.sort;' (ACCEPTS ASSIGN-KEY AT-KEY BUILDALL Bag BagHa

Re: XML module question?

2021-07-16 Thread David Warring
The XML::Writer module side-steps any ordering issues by directly serializing data structures to xml: $ raku -M XML::Writer -e'say XML::Writer.serialize: :wpt[ :lat<42>, :long<69>, "blah" ]' blah On Sat, Jul 17, 2021 at 4:48 AM Bruce Gray wrote: > > On Jul

Re: [perl #131112] [BUG] Regression Missing serialize REPR function for REPR VMHash (Rakudo::Internals::IterationSet)

2017-04-06 Thread David Warring
sing serialize REPR function for REPR VMHash (Rakudo::Internals::IterationSet) On Fri, Apr 7, 2017 at 10:04 AM, David Warring wrote: > # New Ticket Created by David Warring > # Please include the string: [perl #131112] > # in the subject line of all future correspondence about this is

Re: ding!

2017-05-31 Thread David Warring
Does printing an ASCII BEL character do what you want? perl6 -e'print "\x7"' On Thu, Jun 1, 2017 at 3:23 PM, ToddAndMargo wrote: > Hi All, > > Does Perl 6 have a build in "ding" sound, or do I > need to make a system call (which I do all > the time in bash script)? > > Many thanks, > -T > > --

Re: Bi-directional communication with another process

2017-07-27 Thread David Warring
Perl 5 and C have the select call that lets you determine which of a group of file-descriptor are ready for reading and writing. I thought it might be useful here. https://en.wikipedia.org/wiki/Select_(Unix) I've found a module by Tadzik, https://github.com/tadzik/IO-Select, but it's looking defu

Re: Bi-directional communication with another process

2017-07-27 Thread David Warring
Thanks Timo, A Proc::Async example, after reading the doco. Agree, that't better, even for the simple case :-) - David my $proc = Proc::Async.new('sh', '-c', 'for x in `seq 1 1` ; do echo "o$x"; echo "e$x" 1>&2; done'); # subscribe to new output from out and err handles: $proc.stdout.tap(-> $

Are 64 bit natives universally available?

2017-08-27 Thread David Warring
Quick question. I just want to doublle check that int64, uint64 are universally available via Perl 6, before introducing them into modules. e.g. % perl6 -e'my uint64 $n = 99; say $n' 99 - David

Re: Are 64 bit natives universally available?

2017-08-27 Thread David Warring
s, afaik. > > > On 27 Aug 2017, at 22:42, David Warring wrote: > > > > Quick question. > > > > I just want to doublle check that int64, uint64 are universally > available via Perl 6, before introducing them into modules. e.g. > > % perl6 -e

Re: [perl #131965] Shaped arrays can't have zero size

2017-08-27 Thread David Warring
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, bu

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
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 com

Re: [perl #132222] [BUG] 'HAS' Embedded C-Structs not working as documented

2017-10-05 Thread David Warring
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 $.f

Perl 6 / Rakudo unicode code point ranges

2013-02-18 Thread David Warring
ing a problem implementing a concise regex/grammar rule for the above. Looking for advice. Cheers, David Warring

Re: Perl 6 / Rakudo unicode code point ranges

2013-02-20 Thread David Warring
the following much simpler rule should suffice: token nonascii {<- [\x0..\x7F]>} (also using \x7F rather than \c[0x7F] - as suggested) Thanks, - David > On Mon, Feb 18, 2013 at 11:29 PM, David Warring > wrote: > >> Hi Guys, >> A quick question. >> >> I

Re: [perl #117831] [BUG] Grammar capture of '%' separator

2013-05-03 Thread David Warring
It's inconsistent with the %% separator. This also also lets me catch variable operators. e.g. grammar G { token TOP { +%% } token letter{<[a..z]>} token sep{\,|\;} } say G.parse("a;b,c,d"); 「a;b,c,d」 letter => 「a」 sep => 「;」 letter => 「b」 sep => 「,」 letter => 「c」

Re: [perl #117831] [BUG] Grammar capture of '%' separator

2013-05-06 Thread David Warring
Thanks for that. I've added a couple of tests to roast/S05-capture/caps.t. https://github.com/perl6/roast/commit/bc4c9a5ec803a2a19087a922798df6f8f8e653c9 Hope these help. On Sat, May 4, 2013 at 7:45 AM, Patrick R. Michaud via RT < perl6-bugs-follo...@perl.org> wrote: > Now fixed in 4741028: >

Re: [perl #118965] AutoReply: [BUG] Import of overlapping export groups

2013-07-22 Thread David Warring
Same without tabs, sorry: use v6; class Alignment { constant left is export(:horizontal) = 0.0; constant right is export(:horizontal) = 1.0; constant bottom is export(:vertical) = 0.0; constant topis export(:vertical) = 1.0; constant cente

Re: [perl #118965] AutoReply: [BUG] Import of overlapping export groups

2013-07-24 Thread David Warring
Another failing example: use v6; class Test { sub foo is export(:foo) {42}; sub bar is export(:bar) {0x42}; sub baz is export(:foo, :bar) {0o42}; } % perl6 -e 'use Test :foo, :bar' ===SORRY!=== Cannot import symbol &baz from Test, because it already e

Re: Gather, take, newbie questions

2013-12-11 Thread David Warring
Hi Jacinta, I get a bit further with my build of Perl 6, which at least runs: % perl6 fib.pl 0 Are you maybe using an old Perl6? Try: % perl6 -e'say $*PERL' ("name" => "rakudo", "compiler" => {"name" => "rakudo", "ver" => "2013.11-22-g262e600", "release-number" => "", "build-date" => "2013-12-0

Re: match an empty string?

2014-07-12 Thread David Warring
Hi Marc, This looks like a Perl 5 complementary character match: [^:]* But it means something quite different in Perl6. From S05 Bracket rationalization [ ... ] is no longer a character class. It now

Re: Need Help with Perl 6 Module Test::Builder

2015-04-01 Thread David Warring
Hi Tom, I'm seeing the failure(s) as well. I've put in a PR that hopefully addresses this issue - https://github.com/soh-cah-toa/p6-test-builder/pull/2. While we're waiting for the author, you can try checkout out, and building https://github.com/dwarring/p6-test-builder.git Cheers, David On T

Custom accessor compose via traits

2015-07-30 Thread David Warring
The example below is combines traits (S14) Lvalue subs (S06) to create a base class SimpleTiedHash that ties Attributes to the hash using the 'Entry' accessor. PDFCatalog is an example instance class. This mostly works well. But SimpleTiedHash currently has a hacky way of overriding the built-in

Re: Custom accessor compose via traits

2015-07-30 Thread David Warring
t's got a pretty simple tied interface to arrays and hashes, which are a bit more evolved than the above. hash methods are also overrride: AT-KEY ( $foo) , and ASSIGN-KEY ($foo = 42) It's an experiment, which is so far, progressing pretty well, the above is just a nit. - David On Fri, J

Re: Union

2016-04-11 Thread David Warring
Hi Marcel, With regard to checking for endianess. I don't think there's anything built in NativeCall that directly determines this, but hopefuly the following should do it, without resorting to a C compiler. use NativeCall; sub little-endian returns Bool { my $i = CArray[uint32].new: 0x0123456

Re: Union

2016-04-12 Thread David Warring
home at the end > of the week although I only have little endian Intell chips. I will have to > look around for others. Btw, are there still chips storing big endian > paired in two bytes? So your example number would become 0x23, 0x01, 0x67, > 0x45 ? > > Thanks again, > Marcel &g

Re: [perl #129907] [BUG] interaction of class FALLBACK methods and safe method calls (.?)

2016-10-19 Thread David Warring
found in the core Rakudo Mu class. Slightly awkward, but at least working. On Tue, Oct 18, 2016 at 1:35 PM, David Warring wrote: > # New Ticket Created by David Warring > # Please include the string: [perl #129907] > # in the subject line of all future correspondence about this issue. >

[perl #131666] NativeCall MoarVM panic

2019-04-29 Thread David Warring via RT
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);

[perl #131174] [NYI] Atrribute Introspect shape

2017-04-19 Thread David Warring via RT
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

Re: [perl #131965] Shaped arrays can't have zero size

2017-08-27 Thread David Warring via RT
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, bu

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...

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 com

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

2017-09-20 Thread David Warring via RT
ne 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. &g

[perl #128000] [NativeCall] Feature Request: Pointer Arithmetic

2017-10-03 Thread David Warring via RT
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 #132222] [BUG] 'HAS' Embedded C-Structs not working as documented

2017-10-05 Thread David Warring via RT
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 $.f

[perl #128000] [NativeCall] Feature Request: Pointer Arithmetic

2017-10-11 Thread David Warring via RT
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, pa

[perl #131919] [RFC] Returning Failure from failed P6-level .parse

2018-08-06 Thread David Warring via RT
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 2

[perl #121940] [@LARRY] say True but False # should be 'True' (advent2010-day19)

2016-08-09 Thread David Warring via RT
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