Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Operator Overloading

Name: Faggot 2010-06-23 17:00

So, I like operator overloading, but I know people who DETEST it. I realized that the reason that I like operator overloading is that I like to write basic types. So I was thinking: What intrinsic types would a language have to provide such that users of that language would never want to create their own? My ideas thus far:

INTEGER - big integer, of course, that does not overflow.
FIXED - a scaled big integer in a wrapper, for when a float is overkill
FLOAT (REAL) - an arbitrary precision floating point number (base 10, of course)
COMPLEX - a pair of REALS, or some complex system (pun not intended) like C99

STRING - a managed array of UTF-32 codepoints, NUL terminated; a normal string class with the exception of the encoding
BUFFER - a managed array of machine types, defaults to unsigned bytes. The only way to have standard (C program) types is if they are boxed in a buffer.

BOOLEAN - it'll still see use

So, what do you think, /prog/, with these seven types (and arrays of them and classes to aggregate them, of course), would you want to overload operators? For those of you who like operator overloading, of course. What sorts of types am I missing?

Name: Anonymous 2010-06-23 17:25

>>1
People dislike operator overloading because some geniuses like doing stuff like overloading * for strings to mean caesar encoding or whatever.
I guess the main reason people do that is that they want to write terser expressions, but the language doesn't provide a way of creating new operators (like Haskell does).
As for your original question, there are vectors (which I suppose could go under COMPLEX), and other mathematical types like quaternions or matrices.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List