Possible change to array runtime?

sclytrack sclytrack at collector.com
Sat Mar 15 12:05:58 PDT 2014


On Thursday, 13 March 2014 at 21:28:46 UTC, deadalnix wrote:
> If I may, and as author of dcollection, you'll certainly agree, 
> I
> think the way forward is improving the language when it comes to
> collections.
>
> That way, any behavior can be provided as user type. Patching 
> the
> language in such a way is simply moving the problem around.
>

------------------------------------------

If it is not in the language then maybe a design pattern.

------------------------------------------

> The #1 problem we have when it comes to collection is type
> qualifier for template type parameters. I consider this to be on
> of the top problems of D right now, if not the #1 problem.

------------------------------------------

Number 1 problem. Noted.

------------------------------------------


> The problem is that T!ElementType is a ompletely different type
> than T!const(ElementType) . Because of this, if is almost

------------------------------------------

I grasp that you need some sort of an implicit cast from
T!ElementType to T!const(ElementType).

void routine(T!const(ElementType) p) {}
T!ElementType a;

routine(a);

------------------------------------------

Collection!(const(Element1), immutable(Element2), Element3);

There are a lot of different implicit conversions that
stacking up. Now separating the qualifier like this.

T!(ElementType, immutable)

The implicit conversions would then be based on that sole
qualifier at the end. Would this not be sufficient for your
collections? (Not rethorical).

Collection!(const(Element1), immutable(Element2), Element3, 
const);


------------------------------------------


void routine(immutable Collection!(ElementType, const));     //Meh
void routine(immutable Collection!(ElementType, immutable));

I also feel like the above //Meh should not be there.

------------------------------------------


> impossible to provide anything that behave anything close to
> arrays. That is th reason why collection are so scarce in D, 
> this
> is the reason why efforts to implement AA without the black 
> magic

------------------------------------------

I dunno. Not a magician. Have to think.

------------------------------------------


> involved right now are failing.
>

> This problem is a killer for the viability of D2 on the long 
> run.
> I'm not saying that lightly.

------------------------------------------


Everybody wants a solution to this.

That is why everybody is jumping on
this like crazy instead of responding to the
finalize by default thread. (irony)


Some more "Collection and Const Noise".  Collection!const(Noise)


More information about the Digitalmars-d mailing list