Skip to content

Instantly share code, notes, and snippets.

void someFunc(int *something)
shamanas@shamanas-pc:~/Desktop$ rock test
[OutOfBoundsException in ArrayList]: Trying to access an element at offset 0, but size is only 0!
[backtrace]
rock(lang_Exception__Exception_addBacktrace_impl+0x36)[0x81333f1]
rock(lang_Exception__Exception_addBacktrace+0x16)[0x813376a]
rock(lang_Exception__Exception_throw_impl+0x1c)[0x81336e2]
rock(lang_Exception__Exception_throw+0x16)[0x81337ca]
rock(structs_ArrayList__ArrayList_get_impl+0x54)[0x8136b1c]
rock(structs_ArrayList__ArrayList_get+0x24)[0x8137312]
rock(structs_ArrayList____OP_IDX_ArrayList_Int__T+0x1f)[0x81379fd]
import os/[Pipe,Process]
proc := Process new(["test_helper"]) .setStdout(Pipe new()) .setStdin(Pipe new())
data : String = ""
proc executeNoWait()
proc communicate("Foo",data&,null)
data println()
// Expected output: Foo
Binary files rock_tmp/lang_Abstractions.o and test/rock_tmp/lang_Abstractions.o differ
Binary files rock_tmp/lang_BufferIterator.o and test/rock_tmp/lang_BufferIterator.o differ
Binary files rock_tmp/lang_Buffer.o and test/rock_tmp/lang_Buffer.o differ
Binary files rock_tmp/lang_Character.o and test/rock_tmp/lang_Character.o differ
Binary files rock_tmp/lang_Exception.o and test/rock_tmp/lang_Exception.o differ
Binary files rock_tmp/lang_Format.o and test/rock_tmp/lang_Format.o differ
Binary files rock_tmp/lang_IO.o and test/rock_tmp/lang_IO.o differ
Binary files rock_tmp/lang_Iterators.o and test/rock_tmp/lang_Iterators.o differ
Binary files rock_tmp/lang_Memory.o and test/rock_tmp/lang_Memory.o differ
Binary files rock_tmp/lang_Numbers.o and test/rock_tmp/lang_Numbers.o differ
test : func(args: ...) {
if(args count > 0) {
va := args iterator()
while(va hasNext?()) {
T := va getNextType()
if(T == Int) {
thingy := va next(T) as Int
thingy toString() println()
} else if (T == LLong) {
thingy := va next(T) as LLong
{"path":"io/File","globalImports":["lang/Format","lang/VarArgs","lang/Abstractions","lang/IO","lang/Memory","lang/String","lang/Iterators","lang/Character","lang/System","lang/BufferIterator","lang/Numbers","lang/types","lang/Buffer","lang/Exception","structs/ArrayList","io/FileReader","io/FileWriter","io/Reader","io/BufferWriter","io/BufferReader","io/native/FileWin32","io/native/FileUnix"],"namespacedImports":{},"uses":[],"entities":[["_isDirHardlink__quest",{"type":"function","tag":"_isDirHardlink__quest","extern":false,"unmangled":false,"token":[8568,14],"modifiers":["inline"],"genericTypes":[],"fullName":"io_File___isDirHardlink__quest","isThisRef":false,"doc":"","name":"_isDirHardlink__quest","version":null,"returnType":"Bool","arguments":[["dir","CString",null]]}],["File",{"type":"class","abstract":true,"tag":"File","members":[["init",{"type":"method","tag":"method(File, init)","extern":false,"unmangled":false,"token":[672,4],"modifiers":["final"],"genericTypes":[],"fullName":"io_File__File_init","isTh
HwWriter := Class new
HwWriter write := name: n -> ("Hello, " + name) println
f := [left: a right: b; ^a+b]
f = left: a right: b -> ^a+b
g := [a b; ^a-b]
g = a b -> ^a-b
main := ->
// Class is a base type.
// Class new returns a new type. The types type is Class
// But it is still a type of its own :P
// Object is also a base type. It is just an object with standard methods
obj := Object new
// Lambdas
// Yep, C-style string literals, sorry :P
obj hw := -> "Hello World!" println
obj add := a b -> ^a+b
// C-style comments
@alexnask
alexnask / gist:1047348
Created June 26, 2011 07:13
some stiff-lang snippets 8D
Foo: {
bar: fn printfln("Hello World!")
}
Foo.bar()
map: [
"foo":Foo
"bar":{ bar: fn printfln("Bye, World!") }
]
@alexnask
alexnask / gist:1149746
Created August 16, 2011 18:07
Pride programming language ideas and samples
// NO TYPES SEEN, NO HARM DONE <- todo :P
// One-liner comment
/*
Multiligne
comment
*/
var :: Int // Declaration
var = 42 // Assignement
blah :: Int = 42 // Wow! :D