Archive for February, 2009
0×17 – Atomic science, revisited
I lamented earlier about the absence of a racecondition-free find_or_create implementation and somewhat promised to check back with a working implementation. YES, WE CAN: NOW is the time, folks!
As stated there the first thing missing is an advisory locking implementation. With the database as the natural choice for a synchronisation point that implementation [...]
Filed under: Uncategorized | Leave a Comment
Tags: activerecord, atomic, find_or_update, race condition, rails, ruby
Ever done Erlang? Now I wondered how flexible ruby would be and if an erlang style pattern matcher can be done in ruby. As it turns out, I came pretty close:
You might recognize this:
m = matching! [ 1, [ :a, 2 ], 3 ] do
on [ a ] [...]
Filed under: 1rad, ruby | Leave a Comment
Tags: Erlang, pattern matching, ruby
…or: There is a difference between methodname(args) and self.methodname(args)!
The way how ruby deals with private, protected and public messages was a bit unclear to me. So I decided to dig a bit into it and to find out how it is really working. Finally I have irb installed: so lets go and explore.
This pastie shows [...]
Filed under: Uncategorized | Leave a Comment
Tags: private, protected, public, ruby