This file contains hidden or 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
#include <stdio.h> | |
class Mixin1 { | |
protected: | |
Mixin1() {} | |
public: | |
int a, b, c; | |
}; | |
class Mixin2 { |
This file contains hidden or 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 Base { | |
private: | |
int m_Lol; | |
public: | |
Base(int lol) : m_Lol(lol) {} | |
}; | |
class Foo : public Base { | |
public: | |
Foo() : Base(123) {} |
This file contains hidden or 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
#include <iostream> | |
using namespace std; | |
template <int N> int fib() { | |
return fib<N-1>() + fib<N-2>(); | |
} | |
template <> | |
int fib<0>() { |
This file contains hidden or 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
foo: [a, b] { return a + b } | |
puts(foo.disassemble()) |
This file contains hidden or 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
void render() { | |
// Tiles | |
for (int i = 0; i < columns; ++i) | |
{ | |
for (int j = 0; j < rows; ++j) | |
{ | |
glBegin(GL_QUADS); | |
glColor3f(0.0, 1.0, 0.0); | |
glVertex2f(i*tile_width, j*tile_height); | |
glVertex2f(i*tile_width+tile_width, j*tile_height); |
This file contains hidden or 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
void whatever(Object* raw_ptr) { | |
Handle<Object> ptr = raw_ptr; // bookkeeping pointer | |
ptr->lals(); | |
return; | |
// ptr destroyed, book kept | |
} |
This file contains hidden or 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
window: Window("Test") { | |
.button1: Button("Lol") { print "HELLO WORLD" } | |
} | |
window.show | |
window.button1.click | |
window.on_close << { print ":(" } |
This file contains hidden or 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
Mutexed: class { | |
.initialize: [closure] { | |
.closure: closure | |
.mutex: Mutex | |
} | |
.(): [*args] { | |
.mutex.lock | |
.closure(*args) | |
.mutex.unlock |
This file contains hidden or 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
SomeClass: class() { | |
.initialize: { ... } | |
} | |
foo: SomeClass() | |
bar: SomeClass() | |
foo.lol: { print "HELLO" } | |
bar.lol() // => ERROR | |
foo.lol() // => "HELLO" |
This file contains hidden or 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
tIDENTIFIER = tNORMAL_IDENTIFIER | tOPERATOR_IDENTIFIER | |
tNORMAL_IDENTIFIER = [\w][\w\d*]* | |
tOPERATOR_IDENTIFIER = [\+\-\*\/\\]* | |
tOPERATOR_CALL = tIDENTIFIER tIDENTIFIER tIDENTIFIER | |
tNORMAL_CALL = tIDENTIFIER tDOT tSTART_PAREN tARG_LIST tEND_PAREN | |
tEXPR = ... | ... | tOPERATOR_CALL | tNORMAL_CALL | ... | ... |