Re: Inheritance and arrays

2023-07-03 Thread Arafel via Digitalmars-d-learn
On 3/7/23 17:41, Steven Schveighoffer wrote: If Java works, it means that Java either handles the conversion by making a copy, or by properly converting on element fetch/store based on type introspection. It also might use a different mechanism to point at interfaces. As I mentioned in a

Re: Inheritance and arrays

2023-07-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/3/23 7:37 AM, Arafel wrote: That's very clearly an implementation detail leaking: the semantics of the language shouldn't depend on how interfaces and classes are implemented. It's a semantic detail -- casting an array does *not* make a copy, and an array is not a complex object. It's ju

Re: Inheritance and arrays

2023-07-03 Thread Arafel via Digitalmars-d-learn
On 3/7/23 13:03, Rene Zwanenburg wrote: On Monday, 3 July 2023 at 09:50:20 UTC, Arafel wrote: Is this a conscious design decision (if so, why?), or just a leak of some implementation detail, but that could eventually be made to work? Besides the pointer adjustment problem mentioned by FeepingC

Re: Inheritance and arrays

2023-07-03 Thread Arafel via Digitalmars-d-learn
That's very clearly an implementation detail leaking: the semantics of the language shouldn't depend on how interfaces and classes are implemented. So then I need to do something like: ```d ii = cc.map!(a => cast (I) a).array; ``` (I just tested it and it works) Any reason why it can't be don

Re: Inheritance and arrays

2023-07-03 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 3 July 2023 at 09:50:20 UTC, Arafel wrote: Is this a conscious design decision (if so, why?), or just a leak of some implementation detail, but that could eventually be made to work? Besides the pointer adjustment problem mentioned by FeepingCreature, it's an unsound conversion eve

Re: Inheritance and arrays

2023-07-03 Thread FeepingCreature via Digitalmars-d-learn
On Monday, 3 July 2023 at 09:50:20 UTC, Arafel wrote: Hi! I am a D user coming from java, rather than from C/C++ (although obviously also have some exposure to them), and thus apparently one of the few people here who likes OO (within reason, of course). So while I appreciate the fact that

Re: Inheritance and arrays

2023-07-03 Thread FeepingCreature via Digitalmars-d-learn
On Monday, 3 July 2023 at 09:50:20 UTC, Arafel wrote: Hi! I am a D user coming from java, rather than from C/C++ (although obviously also have some exposure to them), and thus apparently one of the few people here who likes OO (within reason, of course). So while I appreciate the fact that

Inheritance and arrays

2023-07-03 Thread Arafel via Digitalmars-d-learn
Hi! I am a D user coming from java, rather than from C/C++ (although obviously also have some exposure to them), and thus apparently one of the few people here who likes OO (within reason, of course). So while I appreciate the fact that D closely follows java's design, I wonder why there is