byKey and byValue: properties or methods?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jan 18 05:59:57 PST 2012


On 1/18/12 7:20 AM, Steven Schveighoffer wrote:
> I think the compiler should not be in the business of generating methods
> or properties that could be trivially handled by the library.

Yes. I'm fighting Walter tooth and nail over that, with pale success.

> The only array-specific properties of an array that the compiler should
> worry about are ptr and length. Everything else should be a library
> function.

Even ptr and length should be in the library. The slice structure should 
be defined in object.d. The only business the compiler has is to lower 
the T[] type syntax and the [ ... ] literal syntax to .object.Slice!T 
and .object.slice(...) form, and to make sure that typeof(T[]) is not 
struct (although factually it is).


Andrei



More information about the Digitalmars-d mailing list