Larry Wall wrote:
On Mon, Jun 30, 2008 at 07:25:11AM -0500, Patrick R. Michaud wrote:
: I'm suspecting that the answer is "yes, they are universal",
: but wanted to confirm it.

Confirmed.  (Though note that Str.reverse probably overrides
Any.reverse, unless we give string reversal a different name.)

Just a thought from my side: doesn't it make sense to unify the
concept of numeric conversion as discussed recently and the
universal methods in Any? The idea is that after a failed dispatch
of 'foo'.join(':') a coercion 'Item as List' is invoked and a one
element list dispatch ('foo',).join(':') is attempted and succeeds.
Note that a round-trip conversion 'Item as List' and 'List as Item'
is lossless and perhaps even identity preserving---that is WHICH
remains unaltered but WHAT switches from Item to List and back.

This would save lots of overloads in Any in favor of a handful of
standard coercions. These need proper anchorage in the dispatch
system, of course. That to me means we need some definition of
"conversion quality" and "conversion distance".

Regards, TSa.

"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to