Re: multimethod + multiple inheritance



Dmitry A. Kazakov wrote:
On Tue, 28 Mar 2006 13:48:05 +0200, Laurent Deniau wrote:
Dmitry A. Kazakov wrote:
But the language should leave some space for the choice. By-reference vs.
by-value should remain open.
Very hard since it influence strongly the efficiency and the design of the language itself.
I don't see why. Ada successfully does this. Small objects are passed
by-copy even if they are records or arrays. The compiler decides it at
will. Note that the language explicitly states that a program exploiting
differences in by-copy and by-reference (aliasing) is erroneous.

You seems to not understand what I am talking about (or don't want to?).

Of course it is. The value of a polymorphic type is itself polymorphic.

Could you give me an example of polymorphic value?

As for polymorphic objects, the type of a polymorphic object is
*statically* known.

Not always (e.g. downcast). May Ada raise type exception like Java or C++? If yes then you should think why, since you think that types are always statically known...

Take a hierarchy of numerals. Start from ordinals, proceed to fields, then
go to matrices. Add slices and submatrices. Add physical dimensions to each
leaf of the hierarchy. Along the way ensure optimal memory and performance.
Add the axis of intervals (interval arithmetic.) Continue to the fuzzy case
based on intervals. [ I know no language capable to do this. ]

C++ is able to do that with no needs for a hierachy. What you are descibing here requires parametric polymorphism (C++ template) and some metaprogramming. Not my concern here.

Then I can add what I need only when I need it, and most of the times, the tests tell me what is missing.

In presence of an exponentially growing number of variants? Come on. Tests
are especially useless here. This is an obvious case for statical
correctness checks. The key requirement for MD is in my view: dispatch
shall never fail in a legal program.

What about very large scale programs (extremly complex) written in dynamically typed languages (see article "Haskell vs. Erlang, Reloaded")? Static typing is one tool amongst others to help the programmer to detect errors at compile time and to help the compiler to make optimizations. But it also often requires to write larger and more complex code (to statisfy the type system constraints). It is far from being the answer to all problems.

It does not influence the hierarchy itself, only the behavior and that is nice since it is the observable part. What is concerned by the hierarchy is sharing behavior, that is where to put such default or specific behavior in the method specialization graph. This is fully behavior oriented, not type oriented.

You didn't say how and where behavior is shared. Reuse is nice but it must
be correct and controllable. Which rules determine propagation of sharing
along the types hierarchy? By the way that was your question initiated the
thread. So it seems that your model does not answer it.

No, it is just that there is some place for choices like in any language design.

I wanted to share experiences on this topic, not to discuss about pro and cons of MD and dynamic typing which is not my concern and also because such discussions usually continue for ever. For my projects, I am using C, C++ and (starting to use) Haskell as main stream languages. C++ has a type system stronger than C and Haskell is strongly typed. But my best productivity is in C where most of the errors are detected during runtime tests.

a+, ld.
.



Relevant Pages

  • Re: Haskell bashing (was Re: F# vs OCaml vs Python vs Haskell: hash table performance)
    ... programming language, it's still a successful experiment :-) ... in teaching us how not to design languages, ... There's a lot any language designers could learn from Haskell, ...
    (comp.lang.functional)
  • Re: Attn Brian Lafferty
    ... Straight up. ... You're a wuss. ... I'd use stronger ... language to your face but after all this is the internet and this is in ...
    (rec.bicycles.racing)
  • Re: C++: 4 paradigms?
    ... Ioannis Vranos: ... In fact it's even stronger: if you like the book then you're probably ... module initialization requires language _support_. ... with module support you get automatic checking of module dependencies ...
    (comp.lang.cpp)
  • Re: continuum hypothesis and 0=1
    ... On Mar 16, 7:41 pm, Aatu Koskensilta ... ZFis much stronger than the simple theory of types. ... I thought that Z proved the soundness of PM. ... predicate for the language of PM in the language of Z, ...
    (sci.math)
  • Re: Bilingualism has ruined Canada but there is still hope.
    ... > If they are truly bilingual, they don't have a stronger language. ... since I know more vocabulary in English than I do my home language. ... with quantum physics and could bore the legs of a donkey about quantum ...
    (sci.lang)