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

Dmitry Olshansky dmitry.olsh at gmail.com
Wed May 30 07:06:00 PDT 2012


On 30.05.2012 17:58, Jacob Carlborg wrote:
> 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
>

Yes, it's OOP classics I think. Dynamic languages are easier in this 
regard. But let's not detract from original topic - locking.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list