Skip to content

Instantly share code, notes, and snippets.

List of stuff we want to be able to do with macros/slangs.

should behave like

The transact commit/rollback thing seems like it declares a sort of mini slang.
# some things should be accesible inside the block so we use a is exposed to mark that
my $shared_by_all_transactions;
slang transact {
my $innards; # the transaction object we are building - created once per each transaction
@pmurias
pmurias / p6.p6
Last active August 10, 2016 15:55 — forked from zoffixznet/p6.p6
use NQPHLL;
grammar Rubyish::Grammar is HLL::Grammar {
token TOP { <statementlist> }
rule statementlist { [ <statement> \n+ ]* }
proto token statement {*}
token statement:sym<puts> {
<sym> <.ws> <?["]> <quote_EXPR: ':q'>
# t/moar/argument-truncation.t
plan(8);
sub pos8(int8 $i) {
ok($i==42, 'int8 pos argument works')
}
sub pos16(int16 $i) {
ok($i==42, 'int16 pos argument works')
}
sub x is export {
Str:U;
}
~
@pmurias
pmurias / gist:7915dd6fc82e526570fbf16bd69ec110
Created July 10, 2018 21:41
native-image -cp 3rdparty/truffle/truffle-api-1.0.0-rc1.jar -jar p6vm.jar >errors 2>&
Build on Server(pid: 9430, port: 26681)
classlist: 135.07 ms
(cap): 749.79 ms
setup: 963.07 ms
analysis: 2,612.86 ms
fatal error: java.lang.NullPointerException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
@pmurias
pmurias / gist:6b6c08b35e9b697860ce24458a2de4d1
Created July 11, 2018 12:30
native-image -jar p6vm.ja
Build on Server(pid: 6196, port: 42749)
classlist: 175.64 ms
(cap): 787.16 ms
setup: 999.88 ms
analysis: 4,829.95 ms
error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a started Thread in the image heap. This is not supported. The object was reached from a static initializer. All static class initialization is done during native image construction, thus a static initializer cannot contain code that captures state dependent on the build machine. Write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected a started Thread in the image heap. This is not supported. The object was reached from a static initializer. All static class initialization is done during native image construction, thus a static initializer cannot contain code that captures state dependent on the build machine. Write your own initialization metho
@pmurias
pmurias / main.dart
Created October 1, 2018 20:22
Test sharing
void main() {
print('Hello, World!');
}
@pmurias
pmurias / main.p6
Last active October 22, 2018 14:18
Hello World
say("Hello World");
@pmurias
pmurias / main.p6
Created October 14, 2018 17:56
Quicksort
# Empty list sorts to the empty list
multi quicksort([]) { () }
# Otherwise, extract first item as pivot...
multi quicksort([$pivot, *@rest]) {
# Partition.
my $before := @rest.grep(* before $pivot);
my $after := @rest.grep(* !before $pivot);
# Sort the partitions.