Recent

Author Topic: Overloading issues with generics and self defined types  (Read 7477 times)

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Overloading issues with generics and self defined types
« Reply #15 on: December 02, 2016, 11:16:57 pm »
Good question. Haven't heard of this distinction before. When I search for "class operators" I find this, but I doubt that is what you mean. This sounds more like it, but I haven't found the documentation for that. Maybe you can point me to the correct documentation?
Oops. I see now that the remark i made is a bit unclear. Sorry for that
(tbh i would have no idea how to call/name it otherwise)

Yes, i meant as in the second link you posted.

I was unable to find specific documentation on that in the available manuals. The information i got is from examples posted on the forums as well as the (test) examples that are part of the fpc project.

In short: an advanced record with the operator defined as class operator (just as showed in the 2nd link you posted).

There was a discussion on this board a while ago that there seem to be a difference between operators being global vs local when the type is being used/specialized when using generics, causing the incompatibility notice from the compiler.

Again, take note that i'm guessing that is what you are currently facing.

PS: this might perhaps be able to help you out a little, except that FPC has other operator names (but those can be found in the FPC documentation).
« Last Edit: December 02, 2016, 11:55:17 pm by molly »

Thaddy

  • Hero Member
  • *****
  • Posts: 14210
  • Probably until I exterminate Putin.
Re: Overloading issues with generics and self defined types
« Reply #16 on: December 03, 2016, 08:50:20 am »
@Fungus: inline generates better code for simple operations like vectors (call overhead, stack preservation omit, indirection, registers). I often check the assembler output and a few different optimization levels for both cpu and fpu operations. Enlightening ;)
Specialize a type, not a var.

 

TinyPortal © 2005-2018