Skip to content

Instantly share code, notes, and snippets.

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
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
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":
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'
@lucs
lucs / gist:d0023dcff6c7c5b104eb
Last active March 19, 2016 04:24
Describing a Perl structure
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.
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:
# 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]> }
class Foo {
has $!foo;
}
my $foo = Foo.new: foo => 'FOO';
@lucs
lucs / vim-toggle-one-line-comments.memo
Last active December 11, 2022 14:51
Vim: Toggle prefix one line comments.
" --------------------------------------------------------------------
" Toggle single character 「#⋯」 style one line comments. Presumes that
" the code starts in column 1 or is indented with 4 spaces or more. So
" converts between pairs of lines like these:
"
" |my $x ⋯
" |#my $x ⋯
"
" | my $x ⋯
" | # my $x ⋯
@lucs
lucs / vim-toggle-C_style-comments.memo
Last active December 11, 2022 14:48
Vim: Toggle 「/*⋯*/」 style one line comments.
" --------------------------------------------------------------------
" Toggle 「/*⋯*/」 style one line comments.
nnoremap <silent> <Plug>CStyleOneLine
\ ^:if search('/\*.*\*/', 'c', line(".")) != 0<cr>
\ :.s,/\* *\(.\{-}\) *\*/,\1,g<cr>
\ :else<cr>
\ :.s,\(\s*\)\(.*\)\(\s*\),\1/\* \2 \*/\3,g<cr>
\ :endif<cr>
\ :noh<cr>