[Python-Dev] PEP 246, redux
Alex Martelli
aleax at aleax.it
Wed Jan 12 00:33:22 CET 2005
On 2005 Jan 11, at 22:08, Phillip J. Eby wrote:
...
>> Yes, you're ALLOWED to stuff with NULL any field that isn't
>> explicitly specified as NOT NULL.
>>
>> But you should ONLY do so when the information is REALLY missing, NOT
>> when you've lost it along the way because you've implemented
>> adapter-chain transitivity: dropping information which you COULD have
>> preserved with a bit more care (==without transitivity) is a
>> violation of PRAGMATICS, of the BEST-EFFORT implication, just as it
>> would be to drop packets once in a while in a TCP/IP stack due to
>> some silly programming bug which was passed silently.
>
> This is again a misleading analogy. You are comparing end-to-end with
> point-to-point. I am saying that if you have a point-to-point
> connection that drops all packets of a particular kind, you should not
> put it into your network, unless you know that an alternate route
> exists that can ensure those packets get through. Otherwise, you are
> breaking the network.
But adaptation is not transmission! It's PERFECTLY acceptable for an
adapter to facade: to show LESS information in the adapted object than
was in the original. It's PERFECTLY acceptable for an adapter to say
"this piece information is not known" when it's adapting an object for
which that information, indeed, is not known. It's only CONJOINING the
two perfectly acceptable adapters, as transitivity by adapter chain
would do automatically, that you end up with a situation that is
pragmatically undesirable: asserting that some piece of information is
not known, when the information IS indeed available -- just not by the
route automatically taken by the transitivity-system.
What happened here is not that either of the adapters registered is
wrong: each does its job in the best way it can. The programming
error, which transitivity hides (degrading the quality of information
resulting from the system -- a subtle kind of degradation that will be
VERY hard to unearth), is simply that the programmer forgot to register
the direct adapter. Without transitivity, the programmer's mistake
emerges easily and immediately; transitivity hides the mistake.
By imposing transitivity, you're essentially asserting that, if a
programmer forgets to code and register an A -> C direct adapter, this
is never a problem, as long as A -> B and B -> C adapters are
registered, because A -> B -> C will give results just as good as the
direct A -> C would have, so there's absolutely no reason to trouble
the programmer about the trivial detail that transitivity is being
used.
At the same time, if I understand correctly, you're ALSO saying that if
two other adapters exist, A -> Z and Z -> C, *THEN* it's an error,
because you don't know when adapting A -> C whether to go via B or via
Z. Well, if you consistently believe what I state in the previous
paragraph, then this is just weird: since you're implicitly asserting
that any old A->?->C transitive adaptation is just as good as a direct
A->C, why should you worry about there being more than one such 2-step
adaptation available? Roll the dice to pick one and just proceed.
Please note that in the last paragraph I'm mostly trying to "reason by
absurd": I do NOT believe one can sensibly assert in the general case
that A->?->C is just as good as A->C, without imposing FAR stronger
constraints on adaptation that we possibly can (QI gets away with it
because, designed from scratch, it can and does impose such
constraints, essentially that all interfaces "belong" to ONE single
object -- no independent 3rd party adaptation, which may be a bigger
loss than the constraints gain, actually).
I'm willing to compromise to the extent of letting any given adaptation
somehow STATE, EXPLICITLY, "this adaptation is lossless and perfect,
and can be used as a part of transitive chains of adaptation without
any cost whatsoever". If we do that, though, the adaptation system
should trust this assertion, so if there are two possibilities of equal
minimal length, such as A->B->C or A->Z->C, with all the steps being
declared lossless and perfect, then it SHOULD just pick one by whatever
criterion, since both will be equally perfect anyway -- so maybe my
reasoning by absurd wasn't totally absurd after all;-).
Would this compromise be acceptable to you?
Alex
More information about the Python-Dev
mailing list