M
Michael DOUBEZ
Julián Albo a écrit :
It is not a mix, from my point of view, the decision tree is the following:
Pre: I have two solutions for matrix script access: 1. [][] and 2. (,)
Q1. Can I implement both ?
R1. Preferabily not, it would only confuse user (i.e. minimal interface
is preferable)
Q2. Then I have to choose one. Which one ?
R2. There are two main reason to choose (,)
a. [][] is not flexible enough for garanteed good optimisation.
b. Using [][] in a flexible manner may yield worse optimisation.
There is no hard proof (the FAQ never claimed one) but [][] is
suspicious. Therefore, it is preferable to use (,) in the general case.
It is not a mix but [][] has a tradeoff between flexibility and
potential optimisation where (,) doesn't.
And the FAQ doesn't say differently: in general, it is good practise to
use (,) and for specific reason you can use [][] at some potential cost.
The point is to call 'special' cases where people implement risky stuff
when they have a safe alternative (i.e. have reason not to use the
general best practice).
No, I mean I will not add a useless interface. If accessor f() is
already implemented, there is no good reason that I can think of to
implement an additionnal accessor g() that does exactely the same thing.
Customer> What is the difference between f() and g() ?
Support> None at all.
Customer> Then which one is best to use?
Support> The one you prefer. It is the cost of liberty.
Customer Gain: 0
Customer Loss: 5 min, a phone call, 30min depression about choice in his
life
Support Gain: 0
Support Loss: Time, sense of uselessness
Compagny Gain: 0
Compagny Loss: Money from support, confused customer
Then it is a problem, that is why the FAQ writes an explaination why (,)
is a better choice in the general case.
So you got your answer.
Q. Which one should I choose ?
A. The (,) because it is the general best practice.
If you think you may have good reasons to use [][], the question would
have been:
Q. Considering I have constraint/functionnality X to achieve, which one
should I choose ?
A. You are right/wrong to use [][] or have the following tradeoff ...
The FAQ is not an expert system.
Personnaly, I don't see any problem or trial of coercition in the FAQ.
If you do, then one of us may have to re-evaluate his reading in order
to communicate together (if we really have to because I am done with
this thread).
Michael
Michael said:As I said before, an array-of-array POD is not at all flexible because
But it is talking about that? I doubt that, given that in the previous
sentence it talks about the [ ] operator in general, not just about raw
arrays. Yet again, the arguments in this point in the FAQ are a confusing
mix between syntax and implementation.
It is not a mix, from my point of view, the decision tree is the following:
Pre: I have two solutions for matrix script access: 1. [][] and 2. (,)
Q1. Can I implement both ?
R1. Preferabily not, it would only confuse user (i.e. minimal interface
is preferable)
Q2. Then I have to choose one. Which one ?
R2. There are two main reason to choose (,)
a. [][] is not flexible enough for garanteed good optimisation.
b. Using [][] in a flexible manner may yield worse optimisation.
There is no hard proof (the FAQ never claimed one) but [][] is
suspicious. Therefore, it is preferable to use (,) in the general case.
It is not a mix but [][] has a tradeoff between flexibility and
potential optimisation where (,) doesn't.
You don't have to if you don't want. People that have a reason to do it will
evaluate if the risk is low enough to him. That is all the point, that
saying that it never be used is an inadequate over-generalization.
And the FAQ doesn't say differently: in general, it is good practise to
use (,) and for specific reason you can use [][] at some potential cost.
The recommandation is here to say that if you do so, then you have a
special need; if you use [][] without special need then you like danger
So the point is just to be able to call 'special' to other people's reasons?
The point is to call 'special' cases where people implement risky stuff
when they have a safe alternative (i.e. have reason not to use the
general best practice).
Perfectly fine for you, but hardly a good argument to satisfactory prove the
point for the world in general.
Do you mean that if you don't like it then nobody will use it?
No, I mean I will not add a useless interface. If accessor f() is
already implemented, there is no good reason that I can think of to
implement an additionnal accessor g() that does exactely the same thing.
Customer> What is the difference between f() and g() ?
Support> None at all.
Customer> Then which one is best to use?
Support> The one you prefer. It is the cost of liberty.
Customer Gain: 0
Customer Loss: 5 min, a phone call, 30min depression about choice in his
life
Support Gain: 0
Support Loss: Time, sense of uselessness
Compagny Gain: 0
Compagny Loss: Money from support, confused customer
If you have a question, I give an answer.The FAQ doesn't forbid but point out the choice to make.
--> [13.10] How do I create a subscript operator for a Matrix class?
--> Use operator() rather than operator[].
This does not look to me like the exposition of a choice that must be
made. Looks like an imperative.
If you have a problem, I propose solutions.
If the proposition looks bad to some people, is criticized.
Then it is a problem, that is why the FAQ writes an explaination why (,)
is a better choice in the general case.
Yes, that is the 'Q' in 'FAQ'. Nothing new here.
So you got your answer.
Q. Which one should I choose ?
A. The (,) because it is the general best practice.
If you think you may have good reasons to use [][], the question would
have been:
Q. Considering I have constraint/functionnality X to achieve, which one
should I choose ?
A. You are right/wrong to use [][] or have the following tradeoff ...
The FAQ is not an expert system.
Personnaly, I don't see any problem or trial of coercition in the FAQ.
If you do, then one of us may have to re-evaluate his reading in order
to communicate together (if we really have to because I am done with
this thread).
Michael