Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread JC Chu
isbinaryoperatoroverloadable() is called once. It first calls internal_check() with the default (LHS, RHS) order. internal_check() accepts or rejects the pair only if it recognizes the pair. Only if (LHS, RHS) is not recognized, will internal_check() be called again with the order reversed. If

Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread JC Chu
Yes. I made that error in my first patch. The new compiler wasn’t even able to compile itself… I think someone should start making a complete chart for acceptance and rejection rules. On Mon, Jul 2, 2012 at 10:51 PM, Jonas Maebe wrote: > Going to a situation where overloading is allowed by de

Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread Sven Barth
Am 02.07.2012 16:51 schrieb "JC Chu" @ acm.org >: > ◦ Restrictions on the string-as-the-first-operand case have been relaxed. I don't know whether you realized that already, but the isbinaryoperatoroverloadable function is called twice: once with the order given by the user and once with the ord

Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread Jonas Maebe
JC Chu wrote on Mon, 02 Jul 2012: On Mon, Jul 2, 2012 at 3:54 PM, Sven Barth wrote: Maybe there were reasons to not allow them... You can of course prepare a bug report or wait till one of the other developers who are more experienced in FPC's overloading speak up. Anyway, here’s a patch fo

Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread JC Chu
Apologies for the previous patch which I didn’t test carefully. I’ve made a revised version which fixes the over-relaxation problem that led to a number of default operand type combinations to be treated as overloadable. ◦ internal_check() now handles enumeration, set, and floating-point types.

Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread Jonas Maebe
Sven Barth wrote on Mon, 02 Jul 2012: Maybe there were reasons to not allow them... You can of course prepare a bug report or wait till one of the other developers who are more experienced in FPC's overloading speak up. I think most of operator overloading support was implemented by Peter,

Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread JC Chu
Anyway, here’s a patch for reviewing… On Mon, Jul 2, 2012 at 3:54 PM, Sven Barth wrote: > Maybe there were reasons to not allow them... You can of course prepare a > bug report or wait till one of the other developers who are more experienced > in FPC's overloading speak up. > -- Best regards

Re: [fpc-pascal] Custom operators for non-record types

2012-07-02 Thread Sven Barth
Am 02.07.2012 04:46, schrieb JC Chu: Do you have some inside information on the extra limitations regarding ordinal, floating point, and set types? As I understand, the only limitation on operator “overloading” should be that the operator do not have a default interpretation for the operands–res