Operator overloading -- lets collect some use cases

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Dec 28 13:17:00 PST 2008


On Sun, Dec 28, 2008 at 11:50 AM, Don <nospam at nospam.com> wrote:

> So, please post any use cases which you consider convincing.

Virtually all I use it for is making containers.  I do almost no
numerical programming.  I would probably not miss much if all I could
overload were opIndex[Assign], opSlice[Assign], opCat[Assign], and
opApply.

As you've noted before, overloading of the arithmetic operators isn't
useful when you only have access to two operands.  It seems like an
AST transformation (macros!) on mathematical transformations into
possibly-compound operations would be much more useful than plain old
operator overloading.  We're already forced to use expression
templates to do anything useful with operator overloading; why not put
a more general, efficient, concise form of that in the language
itself?



More information about the Digitalmars-d mailing list