synchronized (this[.classinfo]) in druntime and phobos

Jacob Carlborg doob at me.com
Wed May 30 06:58:23 PDT 2012


On 2012-05-30 12:21, Dmitry Olshansky wrote:

> Yup. Even Java has Class as object. If D copied most of OOP from Java it
> seems strange that it was replaced by halfhearted factory method in
> object.di
> kind of saying "you have RTTI but it's crippled just in case if it is of
> no use".

I would not compare Java's Class with classes in Objective-C and Ruby. 
In Objective-C and Ruby classes are objects with their own hierarchy of 
inheritance. Example in Ruby:

class Foo
   def bar
     @instance_variable = 1
     @@class_variable = 2
   end

   # class method
   def self.bar
     @instance_variable_on_the_class = 1
     @@class_variable = 3
   end
end

a = Foo
instance_of_foo = a.new

> Still I'd think it's reasonable course to enact slow but steady
> evolution of existing OOP design, changing synchronized/monitors seems
> as good start as any.

I agree.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list