http://d.puremagic.com/issues/show_bug.cgi?id=2095



--- Comment #21 from Bruno Medeiros <bdom.pub+deeb...@gmail.com> 2010-11-19 
15:29:24 PST ---
(In reply to comment #20)
> (In reply to comment #19)
> 
> > Classes are not like arrays and pointers. These are
> > supposed to be lightweight data types, it's out of place for D to have that
> > extra runtime data in these lightweight data types (arrays and pointers). It
> > worries me that you suggested this change without even considering an 
> > approach
> > based on fixing/improving the (static) type system.
> 
> A solution based on the type system (plus a bit of syntax) as in C#/Java seems
> better. But it's probably better to implement it after the current group of
> features is implemented.

Yes, like I mentioned, Steven's solution has some limitations. For example, if
you have B[] the best you have is being allowed to cast it to const(A)[]. But
that means you wont be able to call mutable methods on the elements of that
array, whereas with a wildcard type such as:
  <? extends A>[]
you would be able to call mutable methods of A. So this solution is not
perfect, but it works with existing concepts in D (it only needs const),
whereas we are far away from the point where can add such disrupting and
complex features such as wildcard type. (D's type system seems to be struggling
already as it is)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to