On Tue, Jul 16, 2013 at 10:14 PM, Geoffrey Irving <[email protected]> wrote:

> Am I correct that this discussion is about whether orphan instances
> are important?  If so, banning orphan instances makes a language
> substantially worse than C++, in ways that will certainly damage even
> medium scale software.
>

It's about that, and also about instance genericity and overloading, which
is another largely unresolved issue.


> One easy example from our code is an overloaded "to_python" function
> that converts certain C++ objects into Python objects.  Say the
> to_python trait/type class is declared in library A, there's an
> unrelated library B written by someone who doesn't care about Python,
> and library C depends on both A and B.  As soon as C wants the ability
> to convert B's types to Python, we have orphan instances.
>

Or another one that I implement very frequently: the overloads of >> and <<
for input and output streams, respectively.

The reason these work sensibly in C++ is that the overload mechanism is
lexically scoped. Trait and type class instances are *not* lexically
scoped, and consequently suffer from various forms of formal and practical
insanity.


Jonathan
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to