Blaise at blaise.ru
Blaise at blaise.ru
Sun Dec 26 23:43:26 CET 2021
On 27.12.2021 0:03, Michael Van Canneyt via fpc-devel wrote:
> On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote:
>> On 26.12.2021 19:33, Michael Van Canneyt via fpc-devel wrote:
>>> On Sun, 26 Dec 2021, Blaise--- via fpc-devel wrote:
>>>> following your reasoning, the same should be said about overloading most of the operators: "why is aC+aD better than aC.Add(aD)"?
>>> No. Operators are clearly expressions. ac.Add(aD) is a statement.
>> How can you tell just from that? :) If Add is a function (which is clearly implied by the comparison with the operator Add), then "aC.Add(aD)" is an expression, just like "aC+aD".
> Well: you write it: IF.
> With aC+aD there is no IF, it's an expression. Clear.
I see. I misunderstood your original response. Turns out, you ran with the narrowest possible interpretation of my question, which was the condensed version of the following:
Given two statements:
1) A := B + C;
2) A := B.Add(C);
provided they are semantically equivalent -- they both invoke the method Add on B with the argument C and store the result in A -- which one do you prefer syntactically?
>> Let me offer another comparison and rephrase my quote: following your reasoning, the same should be said about default array properties: "why is aC better than aC.Items"?
> I would not have introduced this. Delphi has.
But was it, in your book, a bad design decision, violating the principles that you outlined earlier?
>> default interface methods
>> a dedicated directive
>> method aliasing
> I think you're getting carried away a little ;-) Let's stick to the topic at hand
I believe we are firmly on topic. You are criticising Borland for bad design decisions; yet, ironically, you seem reluctant to consider as much as possible beforehand for this feature, including other possible features and how the subj should fit with them.
> I am a fan of KISS principle. Hence reusing default, because it is already a keyword.
Merely FTR: OPERATOR is already a keyword as well. Not employed as directive, but still a non-reserved keyword.
> Adding the feature is OK, but let's try to keep impact minimal. For me this means, reuse 'default' keyword and add an operator.
If you agree on the operator, what do we need the DEFAULT for, especially if we are "to keep impact minimal"? Alternative designations, be it a directive or routine aliasing, can be introduced later.
More information about the fpc-devel