Skip to content

Instantly share code, notes, and snippets.

View arnsholt's full-sized avatar

Arne Skjærholt arnsholt

View GitHub Profile
use Net::ZMQ;
use Net::ZMQ::Constants;
use Net::ZMQ::Poll;
say "starting thread...";
my Thread $t .= start: {
my Net::ZMQ::Context $c .= new;
my Net::ZMQ::Socket $s .= new: $c, ZMQ_REP;
$s.bind: "tcp://127.0.0.1:29108";
device($s, $s, :queue);
Finished specialization of 'rotr' (cuid: cuid_24_1447861306.51634)
Spesh of 'rotr' (cuid: cuid_24_1447861306.51634, file: /home/arne/programming/perl/libdigest-perl6/lib/Digest/SHA.pm:67)
Callsite 0x7f3c9745ca00 (2 args, 2 pos)
Positional flags: obj, obj
BB 0 (0x8d6d5e8):
line: 67 (pc 0)
Instructions:
no_op
import Graphics.UI.Gtk as Gtk
import System.Taffybar
import System.Taffybar.Battery
import System.Taffybar.NetMonitor
import System.Taffybar.SimpleClock
import System.Taffybar.Systray
import System.Taffybar.Pager
import System.Taffybar.TaffyPager
import System.Taffybar.Widgets.PollingGraph
(let ((x 0))
(defmacro foo ()
(incf x)
x
)
)
(loop for i from 0 to 3 do (format t "~A~%" (foo)))
; Results:
class C:
def __new__(cls, *args):
print("C.__new__")
return super().__new__(cls)
class D:
pass
C(1,2,3)
D(1,2,3)
@arnsholt
arnsholt / sample.py
Created January 5, 2015 20:52
Should throw an exception
a=2
def foo():
if 0: a = 1
print(a)
foo()
@arnsholt
arnsholt / test
Created November 11, 2014 18:06
QAST and bytecode dump
- QAST::CompUnit
- QAST::Block
- QAST::Stmts
- QAST::Var(local __args__ :decl(param))
- QAST::Stmts
- QAST::Stmts
- QAST::Op(say)
- QAST::Var(lexical x :decl())
MoarVM dump of binary compilation unit:
Test Summary Report
-------------------
t/spec/S02-types/isDEPRECATED.rakudo.jvm (Wstat: 0 Tests: 0 Failed: 0)
Parse errors: Bad plan. You planned 20 tests but ran 0.
t/spec/S02-types/mixhash.rakudo.jvm (Wstat: 0 Tests: 191 Failed: 1)
Failed test: 72
t/spec/S04-phasers/rvalue.rakudo.jvm (Wstat: 0 Tests: 16 Failed: 0)
TODO passed: 10-12
t/spec/S05-mass/properties-derived.rakudo.jvm (Wstat: 0 Tests: 256 Failed: 0)
TODO passed: 241-246
@arnsholt
arnsholt / mixinfix1.patch
Created October 20, 2013 10:51
First attempt at fixing mixin bug
diff --git a/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6Opaque.java b/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6Opaque.java
index dc9fd60..9cb26cb 100644
--- a/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6Opaque.java
+++ b/src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6Opaque.java
@@ -644,7 +644,7 @@ public class P6Opaque extends REPR {
// Ensure target type is also P6opaque-based.
if (!(newType.st.REPR instanceof P6Opaque))
throw ExceptionHandling.dieInternal(tc, "P6opaque can only rebless to another P6opaque-based type");
-
+
@arnsholt
arnsholt / test.pl
Last active December 25, 2015 23:49
Rakudo/JVM rolw mixin shenanigans
my role Foo {
has $!setup;
method postcircumfix:<( )>($args) {
#say self.?bar // 'not what we want';
if nqp::can(self, 'bar') { say self.bar }
else { say 'no what we want' }
}
}