From: Charles Oliver Nutter Date: 2010-06-08T21:21:26+09:00 Subject: Re: [ANN] atomic 0.0.1 - An atomic reference for Ruby It's possible to do some of Clojure's magic right now with my "Cloby" library, which adds a Clojure::Object supertype you can use to get transactional semantics for Ruby instance variables: require 'clojure' class MyClojureObj < Clojure::Object def initialize dosync { @foo = 'foo' } end attr_accessor :foo end obj = MyClojureObj.new puts "obj.foo = " + obj.foo begin puts "Setting obj.foo to 'bar'" obj.foo = 'bar' rescue ConcurrencyError puts "Oops, need a transaction" end puts "Trying again with a transaction" dosync { obj.foo = 'bar' } puts "Success" puts "obj.foo = " + obj.foo This is in the "cloby" library I've never released, at http://github.com/headius/cloby. On Tue, Jun 8, 2010 at 8:08 AM, Robert Dober wrote: > On Tue, Jun 8, 2010 at 6:06 AM, Charles Oliver Nutter > wrote: > What a great idea! > Continue like that and we will be able to program Clojure with Ruby Syntax. > Seriously this is a great concept, as Clojure is a great language. I > guess that following Ola's ideas about polyglot programming Ruby and > Clojure would indeed make a beautiful couple. > Many kudos! > > Cheers > Robert > > -- > The best way to predict the future is to invent it. > -- Alan Kay > >