[m-rev.] for review: structured types in error messages
zoltan.somogyi at runbox.com
Mon Feb 21 14:47:38 AEDT 2022
2022-02-21 11:59 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:
>> + ArgPiecesList = [ReturnValuePieces],
>> + PorFArgBlockPieces = [fixed("func"), fixed("=")] ++
>> FuncResultPrefixPieces ++ ReturnValuePieces ++
> "(func)" instead of "func".
Function declarations without arguments do not need
parentheses, as shown by e.g.
:- func max_one_line_type_length = int.
Function types without arguments do need parentheses
when inside bigger types.
Therefore I see three options:
- Always add parentheses, which is misleading
if the function type is the outermost type.
- Never add parentheses, which is (readable, but)
misleading about the need for parentheses
if the function type is not the outermost type.
- Pass along a flag that says whether the type is
the outermost or not, and add parentheses
only if it is not.
I would prefer the third. Do you object?
> The rest looks fine.
More information about the reviews