Skip to content

Instantly share code, notes, and snippets.

use v6;
class Brainfuck {
has $!buf;
has $!ptr;
submethod BUILD(:$buf-size = 1024) {
$!buf = Buf.new(0 xx $buf-size);
$!ptr = 0;
}
@uasi
uasi / vim.rb
Created November 30, 2010 16:46
Vim formula for Homebrew (EDIT: recent versions of official Homebrew distribution includes one)
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.682'
def features; %w(tiny small normal big huge) end
@uasi
uasi / whatever_curry.diff
Created December 6, 2010 22:09
Fix RT #80256, can't curry * !< $n in Rakudo
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index 9e44a7b..fc6e9c1 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -3541,7 +3541,8 @@ INIT {
%not_curried{'WHERE'} := 2;
}
sub whatever_curry($/, $past, $upto_arity) {
- if $past.isa(PAST::Op) && %not_curried{$past.name} != 2 && $past<pasttype> ne 'call' {
+ if $past.isa(PAST::Op) && %not_curried{$past.name} != 2
diff --git a/S02-builtin_data_types/whatever.t b/S02-builtin_data_types/whatever.t
index 92b5680..49acb2d 100644
--- a/S02-builtin_data_types/whatever.t
+++ b/S02-builtin_data_types/whatever.t
@@ -1,7 +1,7 @@
use v6;
use Test;
-plan 62;
+plan 65;
diff --git a/src/Perl6/Compiler/Role.pm b/src/Perl6/Compiler/Role.pm
index d88dc0e..b3a7daf 100644
--- a/src/Perl6/Compiler/Role.pm
+++ b/src/Perl6/Compiler/Role.pm
@@ -148,6 +148,7 @@ method finish($block) {
PAST::Op.new( :pasttype('bind'),
PAST::Var.new( :name('master_role'), :scope('register'), :isdecl(1) ),
PAST::Op.new( :pasttype('call'), :name('!create_master_role'),
+ ~$name,
~$short_name,
@uasi
uasi / dispatch_invocation.patch
Created December 12, 2010 12:30
Fix RT #77668
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index 9e44a7b..2828b82 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -2547,8 +2547,13 @@ method postfixish($/) {
if $<postfix_prefix_meta_operator> {
my $past := $<OPER>.ast;
if $past && $past.isa(PAST::Op) && $past.pasttype() eq 'call' {
- $past.unshift($past.name());
- $past.name('!dispatch_dispatcher_parallel');
@uasi
uasi / gist:738122
Created December 12, 2010 15:46
An article for Perl 6 advent calendar 2010
We couldn’t find that file to show.
@uasi
uasi / str-new.patch
Created December 14, 2010 13:22
Makes 'foo'.new return Str()
diff --git a/src/builtins/Str.pir b/src/builtins/Str.pir
index ebee051..4c653cb 100644
--- a/src/builtins/Str.pir
+++ b/src/builtins/Str.pir
@@ -28,6 +28,14 @@ as the Perl 6 C<Str> class.
.tailcall '&infix:<eq>'(topic, self)
.end
+=item new()
+
use v6;
module Foo {
my %escape;
for 0 .. 255 -> $c {
%escape{ chr($c) } = sprintf('%%%02X', $c);
}
our sub bar (Int $value) {
return %escape{ chr($value) };
@uasi
uasi / numeric-var-in-decl.patch
Created December 15, 2010 02:49
Possible fix for 'module { "%0" }'
diff --git a/src/Perl6/Grammar.pm b/src/Perl6/Grammar.pm
index 93b73c0..6a307ef 100644
--- a/src/Perl6/Grammar.pm
+++ b/src/Perl6/Grammar.pm
@@ -797,7 +797,7 @@ token variable {
|| [
| <sigil> <twigil>? <desigilname>
| <special_variable>
- | <sigil> $<index>=[\d+] [ <?{ $*IN_DECL}> <.panic: "Can't declare a numeric variable">]?
+ | <sigil> $<index>=[\d+] [ <?{ $*IN_DECL eq 'variable' }> <.panic: "Can't declare a numeric variable">]?