This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p6doc IO::Socket::INET | |
Earlier failure: | |
Dynamic variable @*INC not found | |
in sub search-paths at /opt/prj/l/perl6/rakudo/install/share/perl6/site/resources/B76D4B146FE2E7168A442D065FEAF8672A44F925:31 | |
in sub locate-module at /opt/prj/l/perl6/rakudo/install/share/perl6/site/resources/B76D4B146FE2E7168A442D065FEAF8672A44F925:40 | |
in sub MAIN at /opt/prj/l/perl6/rakudo/install/share/perl6/site/resources/B76D4B146FE2E7168A442D065FEAF8672A44F925:89 | |
in block <unit> at /opt/prj/l/perl6/rakudo/install/share/perl6/site/resources/B76D4B146FE2E7168A442D065FEAF8672A44F925:164 | |
Final error: | |
Type check failed in binding $spec; expected Str but got Failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In Perl 5, arbitrary data could be passed to a module's import() | |
function by doing "use Foo ('some', 'data')". | |
How is something similar (passing arbitrary data to a module when | |
'use'ing it) done in Perl 6? | |
I tried this, unsuccessfully: | |
"Foo.pm6": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
# Match : X aX baX | |
# No match : cX aaX | |
grammar Goo { | |
my %seen; | |
# Allow at most only one each of 'a' or 'b' per match. | |
token TOP { | |
<!{ %seen = () }> <ab>? <ab>? 'X' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Describing a Perl structure. | |
「Desc」 ::= 「Ident」 「Struct」 | |
「Ident」 ::= 〔An identifier, like "foo"〕 | |
「Struct」 ::= 〈「Type」|「Array」|「Hash」〉 | |
「Type」 ::= 〔A type, like "Str"〕 | |
「Array」 ::= @ 「Struct」 | |
「Hash」 ::= % 〈〈$「Ident」? 「Struct」〉|〈「Ident」 「Struct」〉+〉 | |
Each array element is a Str. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I added a 'print' line to the 'connect' function in my Perl 5 | |
'perl-5.22.1/lib/site_perl/5.22.1/i686-linux-multi/DBI.pm', like so: | |
sub connect { | |
my $class = shift; | |
my ($dsn, $user, $pass, $attr, $old_driver) = my @orig_args = @_; | |
print join("--", @_), "\n"; | |
⋯ | |
And when I run this Perl 6 program: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In a grammar, how do I reuse a proto'ed definition? Here for | |
# example, I want <ld> to use some <elem>: | |
#use Grammar::Debugger; | |
grammar Foo { | |
proto token elem {*} | |
token elem:sym<let> { <[a..z]> } | |
token elem:sym<dig> { <[0..9]> } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following two commands were run on the git source (cloned from | |
git://git.kernel.org/pub/scm/git/git.git) | |
$ git rev-list bf0c6e83 | |
bf0c6e839c692142784caf07b523cd69442e57a5 | |
e497ea2a9b6c378f01d092c210af20cbee762475 | |
8bc9a0c769ac1df7820f2dbf8f7b7d64835e3c68 | |
e83c5163316f89bfbde7d9ab23ca2e25604af290 | |
$ git rev-list bf0c6e83 ^8bc9a0c76 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo { | |
has $!foo; | |
} | |
my $foo = Foo.new: foo => 'FOO'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" -------------------------------------------------------------------- | |
" Execute the text that is visually highlighted. This is very practical | |
" when wanting to try out stuff one may want to put in their .vimrc file | |
" or something. | |
function! ExecHighlighted () range | |
" Grab the highlighted text: save the contents of an arbitrary | |
" register, yank the highlighted text to it, copy the register | |
" contents to a local variable, and restore the register |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As explained in this talk by lizmat, | |
<https://www.youtube.com/watch?v=VoxWnNJ0gTI&t=8440s>, to speed up the | |
launch time of a Raku script, one can write all of its MAIN logic in a | |
module, make sure sub MAIN is exported, and create a script that | |
simply "use"s the module (the talk is more general and worth | |
watching). The launch time speedup will occur once the program has | |
been run at least once, since its modules will have been precompiled, | |
as opposed to the script itself. | |
But what if we want to have a custom USAGE() function? We can write |
OlderNewer