Skip to content

Instantly share code, notes, and snippets.

@masak
Created January 15, 2015 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masak/401aeda40b6631ed4ae9 to your computer and use it in GitHub Desktop.
Save masak/401aeda40b6631ed4ae9 to your computer and use it in GitHub Desktop.
Feedback from Theo Van den Heuvel on LinkedIn

Ok, just had my first quality time with Rakudo Star on Windows. We are not there yet, but I am surely going to be a Perl6 user once a full and sufficiently stable version is available. I took a program I wrote some years ago in Perl5 and began converting that to Perl6 for practice. What strikes me is that the whole design is quite orthogonal. I expect to have to remember far less and do more with the code. That said, we are not there yet. When you download and install Rakudo Star on your Windows machine, you are not even told where the software is installed (it is not hard to find: C:\rakudo\bin). Not a iota of documentation, for example on the command line parameters. That may be different on the linux version; I haven't checked. Looking at the wider Perl6 scope, I found several helpful resources, such as doc.perl6.org, and perlcabal.org, but there were quite a bit of things that I could not find anything about. Some of the sources are more than 15 years old, and I doubt if they are still useful. There were some gaping holes in the documentation. As an example, take the trivial line of perl5 code below:

s/A([^B]*)B/$1/g; 

This line is supposed to remove A and B in pairs leaving the stuff inbetween. (It is a simplification of something in my original script.) I found practically nothing about substitution in the multitude of documents on grammars, rules and regexes. There are example programs, but it is not attractive to go through all of them looking for substitutions. Putting together what I found, it seems that in Perl6, there are several ways to express substitution. Here are three

s/A ( <-[B]> ) B/$0/g; 
s:g[A ( <-[B]> ) B] = $0; 
subst(/A ( <-[B]> ) B/, $0, :g); 

None of these seem to work, not even without the :g (=global) attribute. The $0, strangely, does get a value, but only after the statement has passed. Even more strange, the expression

s/A ( <-[B]> ) { say "seeing $0" } B/Z/; 

prints the text between A and B correctly, before setting the whole string to Z. Hopefully, this is a bug in Rakudo. I ended up with the following convoluted horror:

my $fill; 
s/A (<-[B]>*) { $fill = $0 } B/$fill/; 

Of course, this is just one example of the things that may go wrong. I've found some other seriously underdocumented features, if not plain bugs. I may be up for some work yet. I am hoping for an equivalent of the Camel book for Perl6. Should I get my program to work, then my program has become probably less than half the original size without losing any clarity. Impressive. Yes, despite the hiccups I am already a fan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment