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
" -------------------------------------------------------------------- | |
" 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 ⋯ |
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
# 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
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
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
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
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
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
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 |
NewerOlder