Skip to content

Instantly share code, notes, and snippets.

@ronaldxs
ronaldxs / error_NQP.setting.pir
Created June 10, 2012 13:57
NQP core setting error
/home/ron/rakudo/install/bin/parrot --library=src/stage0 src/stage0/nqp.pbc \
--target=pir --output=src/stage1/gen/NQPCORE.setting.pir \
--module-path=src/stage1 --setting=NULL --no-regex-lib \
src/stage1/NQPCORE.setting
invoke() not implemented in class '-1850075165'
current instr.: 'nqp;NQPClassHOW;_block1725' pc 15544 (src/stage1/gen/nqp-mo.pir
:7270) (src/stage1/gen/nqp-mo.pm:784)
called from Sub 'nqp;NQPClassHOW;incorporate_multi_candidates' pc 15255 (src/sta
ge1/gen/nqp-mo.pir:7137) (src/stage1/gen/nqp-mo.pm:770)
called from Sub 'nqp;NQPClassHOW;compose' pc 14533 (src/stage1/gen/nqp-mo.pir:68
@ronaldxs
ronaldxs / gist:2984058
Created June 24, 2012 17:13
nqp build fail win3
cd src\ops && g++ -o nqp_dyncall_ops.dll nqp_dyncall_ops.o ..\6model\reprs\Nativ
eCall.o ..\6model\reprs\CStruct.o ..\6model\reprs\CPointer.o ..\6model\reprs\CAr
ray.o ..\6model\reprs\CStr.o ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a ..\..
\3rdparty\dyncall\dyncallback\libdyncallback_s.a ..\..\3rdparty\dyncall\dynload\
libdynload_s.a -shared "C:\Users\t4\proj\rakudo\install\bin\libparrot.dll" -lm
oldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -
lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -l
odbccp32 -lcomctl32 -lgmp
..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
:(.text+0x2dd): undefined reference to `dcCall_x86_win32_fast'
@ronaldxs
ronaldxs / gist:2984059
Created June 24, 2012 17:13
nqp build fail win32
cd src\ops && g++ -o nqp_dyncall_ops.dll nqp_dyncall_ops.o ..\6model\reprs\Nativ
eCall.o ..\6model\reprs\CStruct.o ..\6model\reprs\CPointer.o ..\6model\reprs\CAr
ray.o ..\6model\reprs\CStr.o ..\..\3rdparty\dyncall\dyncall\libdyncall_s.a ..\..
\3rdparty\dyncall\dyncallback\libdyncallback_s.a ..\..\3rdparty\dyncall\dynload\
libdynload_s.a -shared "C:\Users\t4\proj\rakudo\install\bin\libparrot.dll" -lm
oldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -
lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -l
odbccp32 -lcomctl32 -lgmp
..\..\3rdparty\dyncall\dyncall\libdyncall_s.a(dyncall_callvm.o):dyncall_callvm.c
:(.text+0x2dd): undefined reference to `dcCall_x86_win32_fast'
@ronaldxs
ronaldxs / gist:3388310
Created August 18, 2012 16:47
string to ByteBuffer example
.sub go :main
.local pmc b
.local int n
b = new ['ByteBuffer']
b = utf8:"\x{a2}"
n = elements b
say n
n = b[0]
say n
n = b[1]
@ronaldxs
ronaldxs / gist:fe83eac02aa690f787d3
Created August 3, 2015 20:28
Looks like bug with return value of Proxy.new
sub triple() is rw {
my $storage = 0;
my $p = Proxy.new(
FETCH => method () { $storage },
STORE => method ($new) { $storage = 3 * $new }
);
say $p.perl; #the output here is probably a bug
$p;
}
@ronaldxs
ronaldxs / gist:e0a325c9e3bc716cf7f7
Created August 3, 2015 20:55
attribute mutator
class A {
has $.a;
method a is rw {
Proxy.new(
FETCH => -> $self { $!a },
STORE => -> $self, Int $v { $!a = $v * 2 }
);
}
}
use v6;
#`{{
Combining character classes broken in lots of ways
}}
grammar TestGrammar {
token TOP { ^ <reserved2>+ $ }
use v6;
#`{{
Combining character classes broken in lots of ways
}}
grammar TestGrammar {
token TOP { ^ <reserved2>+ $ }
use v6;
#`{{
From page 49 of http://www.ietf.org/rfc/rfc3986.txt
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
}}
our $f_count = 0;
# If you take away the type of Int $f_count returns 1 and bug goes away
class C {
has Int $.attr is rw;
method attr returns Int is rw {
return Proxy.new(
FETCH => -> $self {$f_count++; 42 },