Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inlining/Extension/Inheritance issue #71

Open
pbroadbery opened this issue Aug 30, 2013 · 1 comment
Open

Inlining/Extension/Inheritance issue #71

pbroadbery opened this issue Aug 30, 2013 · 1 comment

Comments

@pbroadbery
Copy link
Member

.. this comes from investingating issues with Complex Integer.

Start with a domain like:

    Complex(T: ..): with {
      *: (T, %) -> %
      *: (I, %) -> % 
    }

Now inherit these definitions...

    extend Complex(T: ...) with {
       f: (T, %) -> %
    } == add {
      f(t: T, x: %): % == t * x;
    }

All good so far.

   f$Complex I

Now call f. If the compiler has chosen to inline "_" in the definition of f, it hopes to get the first definition of _. Unfortunately, both definitions of "*" have the same hash code in the case of Complex I, and if we get the second, mayhem will result.

For a real example, see the initial version of reciprocal in sal_complex.as.

pbroadbery added a commit that referenced this issue Aug 30, 2013
Do the scalar multiplication in reciprocal manually.
@pbroadbery pbroadbery mentioned this issue Aug 30, 2013
@hemmecke
Copy link
Collaborator

Why is this a particular problem with inlining? If the semantics of *: (T, %) -> % and *: (I, %) -> % is different for T=I, then that is problematic anyway. I'm not aware of the fact that in Aldor one can have two different actions (I, %) -> % that are denoted by the same identifier *.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants