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

Section "Not planned" includes polymorphism, but Jai has polymorphic procedures and structs #8

Open
ngrilly opened this issue Mar 18, 2016 · 6 comments

Comments

@ngrilly
Copy link

ngrilly commented Mar 18, 2016

No description provided.

@refi64
Copy link

refi64 commented Mar 18, 2016

I think the "Not planned" section is referring to runtime polymorphism (e.g. C++ polymorphism), while Jai has parametric polymorphism (also known as generics or templates).

@BSVino
Copy link
Owner

BSVino commented Mar 18, 2016

When I wrote polymorphism there I meant class A : public B, public C ie a class that takes two supers. Not sure what the more specific term for that is, I haven't had time to go in and revise this thing lately. PR's would be appreciated!

@refi64
Copy link

refi64 commented Mar 18, 2016

Multiple inheritance?

@BSVino
Copy link
Owner

BSVino commented Mar 19, 2016

Yep.

@ngrilly
Copy link
Author

ngrilly commented Mar 20, 2016

Ok, I think the proper term in this context is "subtype polymorphism":

https://en.wikipedia.org/wiki/Polymorphism_(computer_science)

ngrilly added a commit to ngrilly/JaiPrimer that referenced this issue Mar 20, 2016
@BSVino
Copy link
Owner

BSVino commented Mar 20, 2016

(Deleted a comment on the PR so the conversation is all in one place)

I think Jai actually has subtype polymorphism through using. May not be getting this syntax right, but:

A :: struct
{
}
B :: struct
{
    using a: A;
}
foo :: (a: A)
{
}

b: B;
foo(b); // Should work

When I wrote "polymorphism" in the document I specifically meant multiple inheritance polymorphism, but I think Jai actually has that too with multiple using statements.

Maybe it's best to just remove that line from the document?

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

3 participants