A possible solution for the opIndexXxxAssign morass

Bill Baxter wbaxter at gmail.com
Tue Oct 13 10:49:31 PDT 2009


On Tue, Oct 13, 2009 at 8:56 AM, Don <nospam at nospam.com> wrote:
> Well timed. I just wrote this operator overloading proposal, part 1.
> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP7
> I concentrated on getting the use cases established.
>
> The indexing thing was something I didn't have a solution for.
>
> BTW we need to deal with slices as well as indexes. I think the way to do
> this is to make a slice into a type of index.

I think it's a good start.

In the list of properties, you should probably mention that 'a' is a scalar.

But I wonder how the rules involving scalars could be enforced, given
that it's possible to define new scalar types.  One would have to tell
the compiler somehow which types are scalars relative to the type
being defined.

The ++ operators don't make sense for many of the types you listed.
Maybe that should be broken out.  Actually three of the things really
stand out as computer-isms that don't really belong with the other
mathematical properties:
x@=y <==> x = x @ y
x++ <==> ++x
x@=y returns x

Also, you can add Clifford algebra, Grassmann algebra, and geometric
algebra to the list of things where the mathematical properties hold.

--bb



More information about the Digitalmars-d mailing list