From: Brian Candler Date: 2009-04-29T22:43:36+09:00 Subject: Re: Ruby Interface of Erlang KDr2 wrote: > see the section Erlix RPC on > http://code.google.com/p/erlix/wiki/ErlixTutorial Just a thought: if you were to move all these constants into an Erlix module (e.g. Erlix::Tuple, Erlix::Int etc) then you could 'include Erlix' and save a lot of typing. The only conflict I can see would be Float, and you can always use ::Float to get the Ruby one should you need it. The separate namespace can also be useful when creating objects dynamically: type = "Tuple" obj = Erlix.const_get(type).new You could also consider module functions as a shortcut for constructors. module Erlix # Fake implementation class Tuple def initialize(*x) @data = *x end end class Int def initialize(x) @data = x end end # Module functions def Tuple(*x) Tuple.new(*x) end module_function :Tuple def Int(*x) Int.new(*x) end module_function :Int # etc end include Erlix puts Tuple(Tuple(Int(1)), Int(2)).inspect Regards, Brian. -- Posted via http://www.ruby-forum.com/.