At 4:23 PM -0400 10/9/04, Michal wrote:
On Sat, 9 Oct 2004, Sam Ruby wrote:

 Inheritance can reduce the combinatorial problem, but it can introduce a
 precendence question.  The most interesting case still seems to be:

mmd_lookup(MMD_ADD, PerlString, PyString)


What if, as a fallback mechanism, the foreign
object were cast into a simpler type? The PyString
could just have a marker on it that says it should
be downcast into a native string (or ParrotString) in
cross language situations. You could do the same for
all the basic types.

That way, if you evaluate $perlString + $pyString
in perl, you get perlish behavior, and if you
evaluate perlString+pyString in python, you get
pythonic behavior.

This, I think, is something I'd prefer to not do. An operation should behave identically regardless of the language that's performing the operation. The alternative, a separate and distinct op, is probably a better option here, though that's got issues as well.


Then there's the question of what things that aren't base types should do. Should PyString+RubyObjectWhichIsAString do concatenation or addition? And how exactly would you tell if the object really is a string or not? (And what about objects that are multiple things simultaneously -- that is, should behave as a string and a number)

I think we may want to think about multiple inheritance for PMC classes and add in some basic attribute types to inherit from. (Like Stringish, Intish, FloatIsh, BigNumish, Booleanish, to denote things that should be considered strings or whatever, rather than just having a string representation)
--
Dan


--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to