Re: Perl6 -> Raku? whats the scope?

2019-10-16 Thread Kaare Rasmussen

Den 15-10-2019 kl. 17:49 skrev Andrew Shitov:

To my opinion, should be done before this year's Christmas. At least 
everything that can be done by the "Perl 6 team"



But after lunch.

/kaare


Re: [perl #130478] multi doesn't work with 'is native'

2017-01-02 Thread Kaare Rasmussen



What does "doesn't work" mean? Please be specific about the problem and include 
your perl6 --version

On my HEAD build the second one fails with

Cannot invoke object with invocation handler in this context
   in sub getgrgid at test.p6 line 11
   in block  at test.p6 line 15

I'm not impressed with the bug tracking. No link provided in the email, 
and my reply with the follow-up information got lost. Today 15.35 I wrote



Perhaps it would be an idea to include the error message:

Cannot invoke object with invocation handler in this context

  in sub getgrgid at b line 11

  in block  at b line 15



and the perl6 --version

This is Rakudo version 2016.12-118-g3baffe7 built on MoarVM version 
2016.12-21-g3dc5647


implementing Perl 6.c.



Re: [perl #130478] AutoReply: multi doesn't work with 'is native'

2017-01-02 Thread Kaare Rasmussen

Perhaps it would be an idea to include the error message:

Cannot invoke object with invocation handler in this context

  in sub getgrgid at b line 11

  in block  at b line 15



and the perl6 --version

This is Rakudo version 2016.12-118-g3baffe7 built on MoarVM version 
2016.12-21-g3dc5647

implementing Perl 6.c.




Re: Startup performance on OS X

2016-10-03 Thread Kaare Rasmussen

On 2016-10-03 12:14, Elizabeth Mattijsen wrote:
Wrt to Pm’s timing of perl 5 with Moose: if you actually want to have 
most of Perl 6’s capabilities in Perl 5 with Moose, you will need to 
load quite a few MooseX:: classes as well. Which cannot have a 
positive effect on load time. 



Right. But that's not too impressive, as one of the major criticisms of 
Moose is exactly the startup overhead it introduces. Mainly explained 
with the compile time of large modules. With Perl 6's compile 
development, I hope we'll end up in a completely other ballpark, eventually.


/kaare



Re: Killer Features of Perl 6

2016-09-15 Thread Kaare Rasmussen

Hi Tony
Thank you all for your input - I have started writing my talk and will 
publish my slides when I'm done.I may even video the talk and publish 
that too


How did it go (if I dare to ask)?

/kaare



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

2016-09-07 Thread Kaare Rasmussen

Hi Joseph

Welcome, and I hope you'll stick around.

Now, I haven't had the time to dig into Perl 6 myself, only to poke at 
it from time to time. But, while waiting for people who know something 
to respond, I'll ask you to be a little concise in certain areas.
* 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.


I wonder what you miss from https://docs.perl6.org/language/classtut. To 
me, it explains the hows and whys very thoroughly. Now, I now people 
have been hard at work improving the documentation, so if you can point 
to what's missing or unclear, I'm sure it will help a lot.


* It would be nice for people coming from Python for a tutorial that 
explained the basic module importing, the scope of things imported, 
and how name collisions are avoided when importing from two modules 
that have the same sub. The official documentation is trying to 
distinguish a bunch of subtle and presumably useful for advanced users 
distinctions that are completely lost on a newcomer. I just want to 
know what is the equivalent of import, from foo import bar, and import 
foo as bar.


It sounds like "arh, do it yourself", but I'd like to say that, coming 
from a Python background, you'd be the perfect person to do just that. 
At least take notes and post them, so it can go into a tutorial of some 
kind.


* Coming from almost any other language the => operator is dark magic 
because of its implicit quoting of the left hand side. Likewise the 
implicit quoting done by . Some explanation of why this is done, 
and how you could write a sub or operator that does the same thing 
would probably go a long way towards making it less confusing.


The pair operator is explained here 
https://docs.perl6.org/language/operators#index-entry-pair_constructor 
and word quoting here 
https://docs.perl6.org/language/quoting#Word_quoting:_qw - perhaps 
they're more Perl 5-like, but both are very handy features. Perhaps you 
can expand a little as to what you'd like explained. Coming from Perl 5, 
I'm certainly damaged in that respect.


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


I guess this is something everybody can have an opinion about. There are 
a number of reasons to go one or the other way. Isn't it a topic for all 
modern languages?


* Types feel like second-class citizens. Without knowing the details 
of the implementation it feels like the errors that Perl can 
statically detect is chosen at random. It's generally useful


I think your wording is misleading. The things that Perl 6 can detect 
when compiling shouldn't be a matter of choice, but of what's possible. 
Perhaps you can give some examples, I'm sure there are perfectly good 
reasons for the way things are. If not, it may be a bug, and the 
compiler can be improved.


argument constructors, are all pretty sweet as well. Macros look 
pretty promising although again I had trouble finding good tutorials.


As I recall it, macros where left out of the initial implementation. So 
you have to wait for another Christmas Present :-)


/kaare



Re: Graphical Toolkits

2016-08-26 Thread Kaare Rasmussen

On 2016-08-26 03:14, Timo Paulssen wrote:
with Inline::Python you can use at least one of the Qt bindings python 


The Inline::* options are mostly interesting when porting or binding to 
existing applications, IMHO. But it's a valid point. Doesn't Perl 5 have 
some implementations as well?



The KDE project has something called "SMOKE" that has almost zero
documentation, but it'd allow us to build a full binding for Qt with
relatively low effort - once someone has SMOKE figured out.


Yeah, I saw that too. It seems rather easy, as a way of doing this, but 
binding to a full toolkit is of course a massive task.

Other than that, we have a native Electron binding, which is the thing
that powers the Atom Editor if i'm not mistaken.

Didn't know about this one.


Hope that helps!


Certainly did, thanks.

/kaare


Graphical Toolkits

2016-08-25 Thread Kaare Rasmussen

Hi

ISTM that right now the only option if you want to develop a graphical 
desktop application is GTK. At least it seems to be the only one on the 
modules list. You may very well correct me if I'm wrong.


I'm thinking if anybody has any knowledge of other projects, perhaps 
Qt5, Wx, or any other on or off this list: 
https://wiki.wxwidgets.org/WxWidgets_Compared_To_Other_Toolkits .


Note: I'm not saying that GTK is bad, or there's anything wrong with it. 
Just looking for alternatives, with a not-too-short horizon.


/kaare



Re: Perl 6 adoption

2016-06-29 Thread Kaare Rasmussen

On 2016-06-29 12:26, webmind wrote:

On 28/06/16 05:26, Kaare Rasmussen wrote:


In that vein, I'm surprised how easy it is to bind to C libraries. This
could very well be a killer feature for Perl 6 compared to other high
level languages. The resource usage has to come down to a reasonable
level for that to be interesting, though.

Can you perhaps recommend a tutorial or something on how this works?



I don't really know of any tutorial. I just wanted to implement 
listen/notify support for PostgreSQL in DBIish 
(https://github.com/perl6/DBIish), so I looked at PostgreSQL's excellent 
documentation and at the existing native bindings in DBIish.


I think this https://docs.perl6.org/language/nativecall has been updated 
since, so perhaps it's a good place to start. Otherwise take a look at 
the modules list, there are plenty of modules linking to native 
libraries, incl gtk, misc compression and sound libraries, etc.


There's even a module to generate a stub class to start with, 
https://github.com/Skarsnik/gptrixie


I think that for more advanced interfaces, these helpers might come in 
handy:


https://github.com/jonathanstowe/NativeHelpers-Array
https://github.com/salortiz/NativeHelpers-Blob

But things may have changed or may change in the future, I haven't 
looked at it for several months now. Which is equivalent to years in 
normal Internet life :-)



/kaare


Re: Perl 6 adoption

2016-06-27 Thread Kaare Rasmussen

On 2016-06-27 15:11, Parrot Raiser wrote:

We should all be thinking about the "killer application" for Perl 6;
the sort of job that is made so much easier by it that people will
overlook all sorts of problems.


In that vein, I'm surprised how easy it is to bind to C libraries. This 
could very well be a killer feature for Perl 6 compared to other high 
level languages. The resource usage has to come down to a reasonable 
level for that to be interesting, though.


/kaare


Perl 6 adoption

2016-06-27 Thread Kaare Rasmussen

Hi List

Now that 6c is 6 months old, I'm wondering if there is any sign of Perl 
6 adoption in companies, startups, etc for professional use?


It may be premature to expect any widespread professional use, but I 
would like to know more about what ecosystem we have. With 
"professional" I don't refer to the code quality, but if anybody is 
seeing Perl 6 as giving them a business advantage.


/kaare


Re: poll (3) (WAS select (3))

2016-04-30 Thread Kaare Rasmussen

Den 01-05-2016 kl. 01:54 skrev Brandon Allbery:


In fact, this is currently being discussed in IRC:


OK; seems there's a way out. Thanks for the info; I'll look into it the 
next time I have a spare moment.


/kaare


poll (3) (WAS select (3))

2016-04-30 Thread Kaare Rasmussen

Den 30-04-2016 kl. 19:14 skrev Kaare Rasmussen:


select(3) is an abysmal API. There's a reason most OSes replaced 
select(2) with a backward compatibility select(3) and moved on to 
something poll-like (look for poll(2) or epoll(2)).




Well, it's not that I fare better with poll. This segfaults on the line 
containing 'note $a.perl;'


I'll put it away for now. Time's up.

/kaare

#!/usr/bin/env perl6

use NativeCall;

class Pollfd is repr('CStruct') {
has int32 $.fd;
has int16 $.events;
has int16 $.revents;
}

constant POLLIN= 0x001;
constant POLLPRI= 0x002;
constant POLLOUT= 0x004;

constant POLLRDNORM= 0x040;
constant POLLRDBAND= 0x080;
constant POLLWRNORM= 0x100;
constant POLLWRBAND= 0x200;

constant POLLMSG= 0x400;
constant POLLREMOVE= 0x1000;
constant POLLRDHUP= 0x2000;

constant POLLERR= 0x008;
constant POLLHUP= 0x010;
constant POLLNVAL= 0x020;

sub poll(CArray[Pollfd], uint64, uint32) returns int32 is native { * }

my $timeout = 5000;
my @readfd := CArray[Pollfd].new(
Pollfd.new(fd => 1, events => POLLIN, revents => 0),
);

note @readfd.WHERE;
note poll(@readfd, @readfd.elems, $timeout);
note @readfd.WHERE;
note 'xx';
my $a = @readfd[0];
note 'xy';
note $a.WHAT;
note $a.perl;




Re: select (3)

2016-04-30 Thread Kaare Rasmussen

Den 30-04-2016 kl. 17:20 skrev Brandon Allbery:
I'm not sure; it's not documented :/ Also not sure offhand how 
endianness plays in to select()'s bit vectors if you build them by 
hand. Which leads to...


One shouldn't probably be surprised to see endianness involved in what 
is described as a bit buffer. Well, thanks for your responses.




select(3) is an abysmal API. There's a reason most OSes replaced 
select(2) with a backward compatibility select(3) and moved on to 
something poll-like (look for poll(2) or epoll(2)).




I know. It's just that select looked simple enough to try out.

/kaare


Re: select (3)

2016-04-30 Thread Kaare Rasmussen

Den 30-04-2016 kl. 15:57 skrev Brandon Allbery:
Note that "nfds" is the highest fd number to check for, plus one. For 
the naïve implementation, you need to add one here.




Right, it wasn't in this example, but it doesn't matter much.


my $readfds = CArray[uint8].new(0, 2);


What is this initialized to? The bit vectors are both in and out 
parameters.




Shouldn't this be a C style array with two bytes, 0 and 2, or 
0010 ?


/kaare


Re: select (3)

2016-04-30 Thread Kaare Rasmussen

Den 30-04-2016 kl. 10:35 skrev Kaare Rasmussen:


Variations over [2] give inconclusive results, so I know I'm doing 
something (probably very basic) wrong. But what?


The current incancation tries to dup the STDIN fd to 14, which should 
be the second last bit in the 2nd uint8. But I've tried to mask in 
many other ways, with no better result.


Anyone who can spot the obvious?



I should probably tell that both dup, dup2 and select apparently work as 
far as they call their respective system calls. Using dup and dup2, I 
see a new fd in the list, and select waits for the given amount of 
seconds and returns 0, or returns sooner and returns 1. The result just 
isn't corresponding to the bit values I use when calling, and I can't 
seem to find a pattern.


/kaare


select (3)

2016-04-30 Thread Kaare Rasmussen

Hi

I've been playing on and off with the system call select (3) 
(http://linux.die.net/man/3/select) in order to learn a bit Perl 6 and 
NativeCall. But I get no traction, so I'd like to know what I'm doing wrong.


Before I start I'd like to wonder a little about the fd usage of moar. 
Perl 5 has three open fd's, moar has 13[1]. I wonder if they're all 
necessary.


Calling select (3) seems straight forward, but I can't seem to get it right.

First, checking with a Perl 5 program [3], you'll see that fd 15 sets 
the last bit in a two-byte "word".


Variations over [2] give inconclusive results, so I know I'm doing 
something (probably very basic) wrong. But what?


The current incancation tries to dup the STDIN fd to 14, which should be 
the second last bit in the 2nd uint8. But I've tried to mask in many 
other ways, with no better result.


Anyone who can spot the obvious?

/kaare

[1] Output from ls -la /proc//fd:

dr-x-- 2 kaare users  0 30 apr 10:25 ./
dr-xr-xr-x 9 kaare users  0 30 apr 10:25 ../
lrwx-- 1 kaare users 64 30 apr 10:25 0 -> /dev/tty
lrwx-- 1 kaare users 64 30 apr 10:25 1 -> /dev/tty
lr-x-- 1 kaare users 64 30 apr 10:25 10 -> /dev/null
lrwx-- 1 kaare users 64 30 apr 10:25 11 -> /dev/tty
lrwx-- 1 kaare users 64 30 apr 10:25 12 -> /dev/tty
lrwx-- 1 kaare users 64 30 apr 10:25 13 -> 
/home/kaare/devel/perl6/test/lib/.precomp/.lock

lrwx-- 1 kaare users 64 30 apr 10:25 2 -> /dev/tty
lr-x-- 1 kaare users 64 30 apr 10:25 3 -> pipe:[1744938]
l-wx-- 1 kaare users 64 30 apr 10:25 4 -> pipe:[1744938]
lrwx-- 1 kaare users 64 30 apr 10:25 5 -> anon_inode:[eventpoll]
lr-x-- 1 kaare users 64 30 apr 10:25 6 -> pipe:[1744939]
l-wx-- 1 kaare users 64 30 apr 10:25 7 -> pipe:[1744939]
lrwx-- 1 kaare users 64 30 apr 10:25 8 -> anon_inode:[eventfd]
lrwx-- 1 kaare users 64 30 apr 10:25 9 -> /dev/tty

[2] Perl 6:

use NativeCall;

class Timeval is repr('CStruct') {
has int64 $.seconds;
has int64 $.microseconds;
}

sub select(int32, CArray[uint8], Pointer, Pointer, Timeval) is native 
returns int { * }


sub dup(int32 --> int32) is native { * };
sub dup2(int32, int32 --> int32) is native { * };

my $nfds = dup(0);
warn $nfds;
my $readfds = CArray[uint8].new(0, 2);
my $timeout = 5;
my $tv = Timeval.new(seconds => $timeout.Int, microseconds => 0);
warn select($nfds, $readfds, Pointer, Pointer, $tv);

[3] Perl 5:
#!/usr/bin/env perl
use strict;
use warnings;
use POSIX qw/dup2/;
my $new = dup2(0, 15);
warn $new;
my $vector = "";
vec($vector, $new, 1) = 1;
my $bits = unpack("b*", $vector);
warn $bits;
my $f = select($vector, undef, undef, 5);
warn $f;

#!/usr/bin/env perl

use strict;
use warnings;
use POSIX qw/dup2/;

my $new = dup2(0, 15);
warn $new;
my $vector = "";
vec($vector, $new, 1) = 1;
my $bits = unpack("b*", $vector);
warn $bits;
my $f = select($vector, undef, undef, 5);
warn $f;



Re: Google Summer of Code and Google Code In

2016-02-21 Thread Kaare Rasmussen

On 2016-02-20 10:54, Vytautas D wrote:


Its a real shame. Thanks to all volunteers. But please do speak up 
earlier. I shouted on #soc-perl irc channel. Saw other people asking 
questions here and there. But not even a single reply or shout for help.




Yeah, feels like a big opportunity for Perl 6 lost here. Well, hopefully 
next year.


/kaare


Re: Most wanted module: Net::SMTP

2016-02-21 Thread Kaare Rasmussen

On 2016-02-20 20:50, Tom Browder wrote:

I notice that module Net::SMTP is on the most wanted list and shown as
a WIP. However, on a lark I decided to try:
I guess you refer to 
https://github.com/perl6/perl6-most-wanted/blob/master/most-wanted/modules.md 
which seems to be a compilation of wishes for Perl 6.  Nobody can decide 
what gets worked on in Perl 6; I think this is just a collection of 
ideas for someone to pick up if they have time.



1. Why is Net::SMTP available in the ecosystem if it is still a WIP
(and doesn't pass testing)?
You put emphasis on the WIP part. Please don't. And I think a lot of the 
modules will fail installation from time to time, and across different 
platforms. No different than Perl 5. Or any other advanced ecosystem.


It's probably there because it, or some of it, worked at some point. And 
the author might get to fix the problems with the tests. It's public so 
you, or somebody else, can look at it at help out.


/kaare


Re: Google Summer of Code and Google Code In

2016-02-18 Thread Kaare Rasmussen
> I have not seen the schedule for signup for this year. I expect that 
we will participate again.


Apparantly, deadline is very close for organizations now: 
https://summerofcode.withgoogle.com/


I hope the People In Power knows and has it under control.

/kaare


IRC channel (was: references and pointers jargon question)

2016-01-13 Thread Kaare Rasmussen

On 2016-01-14 06:39, ToddAndMargo wrote:


I was on the IRC a few days back.  I am a little bit unsure of
what and how to use it.  Seems like a bunch of one line questions
and answers.



It is. but the turn-around time is very low and the reply quality is 
very high. Also, you'll use nopaste for any code questions.


My biggest problem with that channel is, that it's a mixed bag of 
implementation discussions, toolchain problems, and what I'm looking 
for, how to use Perl 6 questions. So I thought a new #perl6-users would 
be nice, but I think they decided to add two channels for the former 
two, #moarvm and #perl6-toolchain, or something close to that.


Perhaps #perl6 will be for the use of Perl 6, and about modules.

/kaare


Re: Perl 6 Module and Program File Extension Conventions?

2016-01-13 Thread Kaare Rasmussen
But I don't know why they still suggest to use any specific suffix. It's 
of now interest or value to the user in which language the program is 
written.


/kaare


Looking at the documentation, http://doc.perl6.org/language/modules
see "Basic structure".

On 1/12/16, Parrot Raiser <1parr...@gmail.com> wrote:

For *nix, don't use a suffix. #! does the job.

For Windows, you'll want to leave .pl and .pm for Perl 5.

On 1/12/16, Tom Browder  wrote:

In Perl 5 it seems the prevailing convention (in my experience) is to
use ".pl" for Perl programs and ".pm" as file suffixes for Perl
modules.

In Perl 6 I have seen in the various repos, blogs, and doc both ".pl",
".p6", and ".pl6" for programs and both ".pm" and ".pm6" for modules.

Is there any consensus or preferred set of file extensions for Perl 6
in use among the heavy-hitter developers?

I try not to be overly concerned about such matters, but consistency
does help IMHO, and I would like to use community best practices when
I can

Thanks.

Best regards,

-Tom





Re: Recalling previous commands

2016-01-02 Thread Kaare Rasmussen

Hi

Linenoise is included in Task::Star. 
https://github.com/tadzik/Task-Star/commit/8ff101ae15


So it's strange I had to install it after I installed rakudo, panda, and 
Task::Star.


I guess things aren't really streamlined to perfection yet.

/kaare


Re: Recalling previous commands

2016-01-01 Thread Kaare Rasmussen

Hi

Try Out Linenoise
https://github.com/hoelzro/p6-linenoise/
panda install Linenoise


Command history is essential to the user experience of a REPL. I wonder 
why Linenoise just isn't included in Task::Star (?)


/kaare


Re: release?

2015-12-29 Thread Kaare Rasmussen

Hi Darren
On that note, are there going to be Perl 6 versions 6.x.y where {x,y} 
are integers?  Will 6.0.0 be the first such one? -- Darren Duncan


The next Perl 6 release will be called 6.d. Hopefully it will take a 
while before that happens.


I hope there will be a lot of Rakudo releases in the meantime. I guess 
the next is called 2016.1 ?


/kaare



On 2015-12-29 12:51 AM, Tobias Leich wrote:
Hi, the first official Perl 6 (the language) release is not called 
6.0.0, it is

called 6.c.
And this is what has been shipped with the Rakudo compiler release 
2015.12.


Cheers, Tobias

Am 27.12.2015 um 20:33 schrieb webmind:

Hiya,

I'm a bit confused, there is a major release for Perl 6, but I know
wonder if this is the 6.0.0 release or when this will be?

Thanks

web










Re: release?

2015-12-27 Thread Kaare Rasmussen

Hi webmind

I'm a bit confused, there is a major release for Perl 6, but I know
wonder if this is the 6.0.0 release or when this will be?



I understand your confusion.

Most people would expect something downloadable, and there is actually a 
Rakudo release to go. But 6.c is really the promise that the specs will 
not change overnight, that it's possible to write a program, or a 
module, to a spec.


The rakudo release is at 
http://rakudo.org/downloads/rakudo/rakudo-2015.12.tar.gz


/kaare


Re: Missing documentation

2015-10-28 Thread Kaare Rasmussen

On 10/28/2015 08:31 PM, Parrot Raiser wrote:

This Perl 5 to 6 Translation guide http://doc.perl6.org/language/5to6
is mentioned in several places, but returns a 404.  Is it obsolete, or
just misplaced?
This one you're looking for? 
http://doc.perl6.org/language/5to6-nutshell.html