June 2010
14 posts
An ooc mode for thou, oh Emacs. →
Sup Dawg, I herd you liked ooc so we put ooc in your emacs so you can rock while you rock.
(Yes, repeating old memes makes me feel smugly superior. Also, I hear lack of sleep has the same effect has drugs. Never tried drugs though, couldn’t tell.)
ØMQ bindings for ooc →
ØMQ is a software library that lets you quickly design and implement a fast message-based application.
The client/server example was particularly enjoyable to port from C++, as it gives shorter and easier to read/comprehend code. Reminder: ‘||’ in a function call creates a closure. One could use func {} instead but my personal preference goes to the double bars, because it’s...
A grep ripoff in ooc →
Synchronizing threads using mutexes →
In the high-level world, we prefer to use Actors or the STM model - but it has to rely on something, right? Here’s the low-level part of concurrency in ooc: threads and mutexes. Implemented on PThreads for Unix-y platforms, and with Win32 threads on Windows.
Meanwhile, here’s a small example of mutex usage in ooc.
EDIT: Mutex works on Linux, OSX, and Windows now - enjoy!
The compiler is your friend
When you do something like:
main: func { blah := Process new("ls") blah execute() }
The compiler now tells you:
missingimport.ooc:4:13 [ERROR] Undefined symbol 'Process' (Hint: there's such a type in os/Process) blah := Process new("ls") ~~~~~~~ [FAIL]
Neat, eh?
OpenAL + libvorbis example usage in ooc →
A GTK+ one-liner with call chaining →
'Tis the dream of each programmer Before his life is done, To write three lines of APL And make the damn thing run.
Call chaining just got better. It used to allow you to do things like:
fw write(“Hey, my name is “). write(name). write(“, what’s yours?”). flush()
But it used to be restricted on a scope-level. Now it’s not anymore, which means you can...
4 tags
Arrays demystified - on the way to a treasure... →
Rewrote some of @wandernauta’s code to use arrays of arrays. Until we get proper docs on everything (ha!), I thought taking this as an example couldn’t hurt.
Just to be clear: objects are references in ooc, so when I declare Tile[][], it holds pointers to tiles, hence 1) they need to be initialized properly, 2) they only take 4/8 bytes in the array depending on your platform.
Also,...
Does ooc support UTF-8? →
Yes and no. String length() returns the number of bytes, not in characters. UTF-8 is tricky. There are no strict boundaries between characters, or rather, ‘grapheme clusters’.
Integrating something like utf8proc could be interesting, but every lib has its limitations. The most important thing is to know how far you have to go for your app.
But as this yajl example shows, you can...
Mealy automaton in ooc →
Here’s a simple way to do code a mealy finite simple machine, using enums, a class, booleans, iterating through a string, slicing, match.. all kinds of goodies!
EDIT: here’s a little background info for the uninformed
(Note to self: make ‘match’ play nice with enum values so that we don’t have to qualify them everytime.)
5 tags
rock 0.9.1 - arrays, closures syntax, iterators,... →
it’s out there, and it’s coming out to get you.
in there: smarter partial recompilation, lib-caching so your compile times are greatly reduced, awesome closure syntax, native ooc arrays (with literals, multi-dimensional, bound-checked, etc.), backward iterators, cleanup of threading/Thread, fixes, and much more!
CPU Caches and Why You Care →
Lovely presentation by Scott Meier on CPU caches. Not exactly ooc-centric, but - you should care. Trust me.
4 tags
The Ruby connection →
Birds of a feather flock together.
In that spirit, Kaspar Schiess is working on an ooc compiler written in Ruby - another language with outstanding syntax, in order to get a compiler easy to understand and tinker with.
May this be the beginning of a long and fruitful collaboration!
A few pointers →
Despite all the high-level goodness ooc provides, it still allows you to cut both your feet with a machete, if you’re a badass Mexican.
Here’s a little tutorial on pointers and references that should give you a good feel of how we handle those kind of things in the ooc world. (Beware though - once you try postfix syntax for pointers, there’s no going back!)