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

JC Chu jcchu at acm.org
Wed Jul 4 15:20:04 CEST 2012


Thank you both for the tips.

I have just finished the patch and tested it.  The patched version
gives identical test results as the trunk.

The patch refines operator overloading acceptance and rejection rules
for both unary and binary operators.

The new rules for unary operators allow NOT to be defined on
enumeration and floating-point types.

The new rules for binary operators should allow for all operator
overloads that do not conflict with the default interpretation (DI).*
The rules were designed based on a classification of operators and
operand types according to their roles in the DI, and achieved a high
accuracy in the first trial.

*Note: An exception is that the operator IN cannot be overloaded with
the signature (ordinal, set), where ordinal is any type covered by
TOrdDef, even though not all such typs have a corresponding set type.
This is unlikely to become a real obstacle, however, and can be
relaxed very easily.

The patch will soon be added to the bug report at
<http://bugs.freepascal.org/view.php?id=22359>.


On Tue, Jul 3, 2012 at 9:28 PM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> Sven Barth wrote on Tue, 03 Jul 2012:
>
>> Am 03.07.2012 12:23 schrieb "JC Chu" <jcchu at acm.org>:
>>>
>>>
>>> Could you elaborate on that?  Do I need to run the test suite with the
>>> old compiler first?
>>
>>
>> * first do a "make cycle" on a unmodified checkout, then run the
>> testsuite.
>
>
> While "make cycle" is useful as a first test, for a complete testsuite run
> you also need the packages. So before running the testsuite, run a "make
> all" in the top level FPC directory (possibly preceded by an "rm build*" in
> case make says that nothing needs to be done for "all").
>
> Also, if you do this regularly and have a multicore, you can speed up things
> significantly by using (replace "x" with the number of cores you have, or
> the number of cores+1 if you have a slow hard drive or are performing a cold
> build)
> a) for the fpc make all: make all -j x FPMAKEOPT="-T x"
> b) for the testsuite: make full TEST_OPT="-O2" -j x
>
> (the testsuite "full" target is equivalent to "clean all digest", but
> written in a way that makes all dependencies explicit so that parallel
> building works correctly)
>
>
> Jonas
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


-- 
Best regards,
JC Chu



More information about the fpc-pascal mailing list