[fpc-devel] new features and facilities
Sven Barth
pascaldragon at googlemail.com
Fri Oct 9 13:27:23 CEST 2015
Am 09.10.2015 08:36 schrieb "Michael Van Canneyt" <michael at freepascal.org>:
>> There also another reason why I prefer the variant with the if: ease to
>> implement in the compiler.
>>
>> For the if one merely needs to add a corresponding case in factor() while
>> for the ?: one needs to fiddle with the compiler's operator precedence
>> rules that are applied in sub_expr() which can lead to desaster either
>> during implementation or later on when bugs are discovered...
>
>
> I don't see how the use of "if" differs from "?" in rules of precedence,
they are at the exact same level.
> They're both just tokens to the compiler. At least "?" has the advantage
of being new and not yet used, so is unambiguously.
The tokens themselves are merely tokens to the compiler, but you need to
ensure that expressions like "a + b ? c : d + e" are handled correctly by
the compiler (and right now I don't even care what the rules would be
exactly, only /that/ they need to be).
Though thinking about it one could maybe add the check for the ?-token to
the end of factor(), that should hopefully cover all cases... :/ (this does
however not mean that I support the syntax ;) )
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20151009/78831ddb/attachment.html>
More information about the fpc-devel
mailing list