Re: Any plans to support STL value types?

2015-05-19 Thread w0rp via Digitalmars-d
JMD is right. Using inheritance for value types is a bad idea, and it shouldn't be done. The problem is that when you assign a derived value type to a base value type, the members in the derived type are removed, and this can lead to very weird behaviour. You could enforce that derived value

Re: Any plans to support STL value types?

2015-05-16 Thread QAston via Digitalmars-d
On Saturday, 16 May 2015 at 09:20:37 UTC, Kagamin wrote: Currently D frontend can't use such idiom: it has classes, which support inheritance, but are reference types, it also has structs, which don't support inheritance and are value types, and they don't mix. In this case inheritance is

Re: Any plans to support STL value types?

2015-05-16 Thread Jonathan M Davis via Digitalmars-d
On Friday, 15 May 2015 at 21:11:48 UTC, Timon Gehr wrote: On 05/15/2015 09:44 PM, Jonathan M Davis wrote: On Friday, 15 May 2015 at 18:42:31 UTC, Kagamin wrote: Many STL types inherit from base classes, yet they are used as value types: std::string, std::vector etc. Are there plans to support

Re: Any plans to support STL value types?

2015-05-16 Thread Kagamin via Digitalmars-d
On Friday, 15 May 2015 at 19:44:29 UTC, Jonathan M Davis wrote: So, while I don't know how we're going to be handling STL types (I don't even know what the current state of C++ state support is, since it keeps improving), I really don't see why there's value in supported inheritance with value

Re: Any plans to support STL value types?

2015-05-16 Thread Kagamin via Digitalmars-d
On Saturday, 16 May 2015 at 08:53:00 UTC, Jonathan M Davis wrote: But regardless, I don't see how the C++ class having a base class in C++ would really matter when interfacing with D if the class is a value type. Currently D frontend can't use such idiom: it has classes, which support

Re: Any plans to support STL value types?

2015-05-16 Thread Jonathan M Davis via Digitalmars-d
On Saturday, 16 May 2015 at 09:11:46 UTC, Kagamin wrote: Inheritance in C++ is not always for polymorphism, often it's just functionality inheritance Exactly, so if D support C++ classes as value types, they'd just be declared as structs in D and no inheritance would be required. Any

Re: Any plans to support STL value types?

2015-05-16 Thread lobo via Digitalmars-d
On Saturday, 16 May 2015 at 12:22:00 UTC, QAston wrote: On Saturday, 16 May 2015 at 09:20:37 UTC, Kagamin wrote: Currently D frontend can't use such idiom: it has classes, which support inheritance, but are reference types, it also has structs, which don't support inheritance and are value

Re: Any plans to support STL value types?

2015-05-15 Thread Jonathan M Davis via Digitalmars-d
On Friday, 15 May 2015 at 18:42:31 UTC, Kagamin wrote: Many STL types inherit from base classes, yet they are used as value types: std::string, std::vector etc. Are there plans to support C++ types with inheritance as proper value types in D frontend? Given that the inheritance they have is

Re: Any plans to support STL value types?

2015-05-15 Thread anonymous via Digitalmars-d
On Friday, 15 May 2015 at 19:44:29 UTC, Jonathan M Davis wrote: On Friday, 15 May 2015 at 18:42:31 UTC, Kagamin wrote: Many STL types inherit from base classes, yet they are used as value types: std::string, std::vector etc. Are there plans to support C++ types with inheritance as proper value

Re: Any plans to support STL value types?

2015-05-15 Thread Laeeth Isharc via Digitalmars-d
On Friday, 15 May 2015 at 19:44:29 UTC, Jonathan M Davis wrote: On Friday, 15 May 2015 at 18:42:31 UTC, Kagamin wrote: Many STL types inherit from base classes, yet they are used as value types: std::string, std::vector etc. Are there plans to support C++ types with inheritance as proper value

Re: Any plans to support STL value types?

2015-05-15 Thread Dennis Ritchie via Digitalmars-d
On Friday, 15 May 2015 at 19:51:09 UTC, anonymous wrote: rust does it just fine without slicing, and supports both static dispatch and dynamic dispatch through the same interface. http://blog.rust-lang.org/2015/05/11/traits.html honestly, this is one of the worst parts of D. Being forced to

Any plans to support STL value types?

2015-05-15 Thread Kagamin via Digitalmars-d
Many STL types inherit from base classes, yet they are used as value types: std::string, std::vector etc. Are there plans to support C++ types with inheritance as proper value types in D frontend?

Re: Any plans to support STL value types?

2015-05-15 Thread Timon Gehr via Digitalmars-d
On 05/15/2015 09:44 PM, Jonathan M Davis wrote: On Friday, 15 May 2015 at 18:42:31 UTC, Kagamin wrote: Many STL types inherit from base classes, yet they are used as value types: std::string, std::vector etc. Are there plans to support C++ types with inheritance as proper value types in D