raku

“Could not get Timeline data” when using Timeline Visualization with Comma IDE

瘦欲@ 提交于 2019-12-12 17:14:35
问题 After implementing the answer to this question on how to set up a script for time visualization in this project (which uses a small extension to the published Log::Timeline that allows me to set the logging file from the program itself), I still get the same error 12:18 Timeline connection error: Could not get timeline data: java.net.ConnectException: Conexión rehusada (which means refused connection). I've also checked the created files, and they are empty, they don't receive anything. I'm

Is there still a race condition? [closed]

不想你离开。 提交于 2019-12-12 12:14:08
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 months ago . this is the current state of my little unimportant async experiment. Can you spot any races or leaks? Common critique is also welcome. class GameObject { has Int $.id; has Int $.x is rw; has Int $.y is rw; has $.game; has Int $.speed; #the higher the faster multi method start(

Why do I get 'divide by zero` errors when I try to run my script with Rakudo?

筅森魡賤 提交于 2019-12-12 11:47:35
问题 I just built Rakudo and Parrot so that I could play with it and get started on learning Perl 6. I downloaded the Perl 6 book and happily typed in the first demo program (the tennis tournament example). When I try to run the program, I get an error: Divide by zero current instr.: '' pc -1 ((unknown file):-1) I have my perl6 binary in the build directory. I added a scripts directory under the rakudo build directory: rakudo |- perl6 \- scripts |- perlbook_02.01 \- scores If I try to run even a

Perl6 equivalent of Perl's 'store' or 'use Storable'

爱⌒轻易说出口 提交于 2019-12-12 10:34:41
问题 I am attempting to write a hash, which is written very slowly, into a data file, but am unsure about how Perl6 does this in comparison to Perl5. This is a similar question Storing intermediate data in a file in Perl 6 but I don't see how I can use anything written there, specifically messagepack. I'd like to see the Perl6 equivalent of my %hash = ( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4); use Storable; store \%hash, 'hash.pldata'; and then read with my $hashref = retrieve('hash.pldata'); my

How can I compile perl6 file to exe

元气小坏坏 提交于 2019-12-12 09:34:34
问题 I am playing with perl6 version which built on MoarVM on windows. I created some perl6 file and want to compile it to exe. I tried the following: perl6 --target=MAST r.pl>r Now I want to compile the r to executable I found this link which talk about how to that using Parrot but I am using MoarVM target: http://perlgeek.de/blog-en/perl-6/my-first-executable.writeback my question how can i compile MoarvVM targeted file to windows executable ? 回答1: Unfortunately, the answer is to target JVM and

Passing an inlined CArray in a CStruct to a shared library using NativeCall

删除回忆录丶 提交于 2019-12-10 14:53:17
问题 This is a follow-up question to " How to declare native array of fixed size in Perl 6? ". In that question it was discussed how to incorporate an array of a fixed size into a CStruct . In this answer it was suggested to use HAS to inline a CArray in the CStruct . When I tested this idea, I ran into some strange behavior that could not be resolved in the comments section below the question, so I decided to write it up as a new question. Here is is my C test library code: slib.c : #include

How can I declare and use a Perl 6 module in the same file as the program?

 ̄綄美尐妖づ 提交于 2019-12-10 13:34:40
问题 Sometimes I don't want multiples files, especially if I'm playing around with an idea that I want to keep a nice structure that can turn into something later. I'd like to do something like this: module Foo { sub foo ( Int:D $number ) is export { say "In Foo"; } } foo( 137 ); Running this, I get a compilation error (which I think is a bit odd for a dynamic language): ===SORRY!=== Error while compiling /Users/brian/Desktop/multi.pl Undeclared routine: foo used at line 9 Reading the Perl 6

What is the best way to flush precompiled perl6 modules?

痞子三分冷 提交于 2019-12-10 13:32:08
问题 I am trying to refactor some code. My approach (using vi) is to copy my old libraries from /lib to /lib2. That way I can hack out big sections, but still have a framework to refactor. So I go ahead and change mymain.p6 header from use lib '../lib'; to use lib '../lib2'; . Then I delete a chunk of the lines in ../lib2/mylibrary.pm6 and make darn sure :w is doing what I expect. Imagine my surprise when my program still works perfectly despite having been largely deleted. It even works when I rm

How to hack on installed perl6 module source?

ぐ巨炮叔叔 提交于 2019-12-10 13:27:48
问题 I'd like to be able to view and make changes to the source code of installed (via zef ) perl6 modules. How can I do that? On my system, the module sources are under ~/.perl6/sources/ and there's also some kind of metadata file about the modules in ~/.perl6/dist/ . I can also use zef locate ... to show a module's source path, but making changes directly to the source files doesn't seem to have any effects (i.e., use the module from the REPL doesn't show my changes). I'm guessing it's because

Assigning a value to the attribute of a mixed-in role

不打扰是莪最后的温柔 提交于 2019-12-10 13:07:01
问题 I'm trying to work an example that uses the Enumeration role in Perl 6 (as part of fixing doc issue Enumeration role is not documented). I came up with this simple example: class DNA does Enumeration { my $DNAindex = 0; my %pairings = %( A => "T", T => "A", C => "G", G => "T" ); method new( $base-pair where "A" | "C" | "G" | "T" ) { self.bless( key => $base-pair, value => %pairings{$base-pair}, index => 33); } multi method gist(::?CLASS:D:) { return "$!key -> $!value with $!index"; } } for <A