Christopher Wright пишет: > Weed wrote: >> Denis Koroskin пишет: >> >>> I'd suggest you to state you ideas as simple and keep your posts as >>> small as possible (trust me, few people like reading long posts). >> >> The extra-short formulation of my idea: >> Objects should be divided on POD (struct) and non-POD (class). >> >> Instead of such division as now: POD && value type (struct) and POD && >> reference type (class). > > The reference versus value type difference is just a matter of defaults. > > Returning a class instance on the stack from a function is possible with > inout parameters, though you can't use a constructor in that case: > > void main () > { > scope MyClass obj = new MyClass; > foo (obj); > } > > void foo (inout MyClass obj) > { > // initialize obj somehow > }
Problem not only with constructor calling. This way does not works for temporary objects. For example, at operator overloading in expression like a = b + c + d. The case in detail was considered in this thread: "division of objects into classes and structures is bad", http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=81359 Also, it impossible to create an array of scope objects.