-
Notifications
You must be signed in to change notification settings - Fork 34
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
dynamic and switch #604
Comments
No, you need to throw a type error at run time if |
Hurrm, is it? I suppose it is.... |
@chochos, Ross is right, let's make it a runtime check. |
shit... ok; can you open an issue in ceylon-js please? |
Another interesting case is generic invocations and instantiations (and this includes tuple and iterable enumeration). If we were erasing generics, then |
Yes, you need to get it from the run-time type. This is why you need to make sure type-argument inference behaves nicely (which it doesn't yet). |
There is no runtime type. This is JavaScript. Get runtime types out of your head.
It behaves gorgeously. I don't know what you're talking about. |
To clarify: there is a meaningful runtime type only for instances of classes defined in Ceylon. For other classes it would need to be a runtime exception. So you could not have a |
There may not be an explicit tag indicating the type, but there is still a type. The absence of such a tag would mean the type is something like
Heh, I'm sensing sarcasm.
Sure you can. It's a |
No, seriously. Our type arg inference is awe-inspiring.
No, because the impl of |
But not necessarily good enough for dynamically typed invocation of generic methods.
Ah, I missed the
So if |
Right, well, I think that's probably right. But usually, if I write:
I've been thinking I would I get a
Then I will get a |
That's true, and it's an important problem. Basically, the second program is more accurate in a sense. That's why I've been advocating a semantics which is compatible with this. |
Actually, that last example will give you a |
Wait, that's the case even if |
Yes. The type parameter is calculated at compile time, and since it's unknown we can only set it to be |
If, statically, we know Essentially, the property we want for |
Statically (at compile time) we have absolutely no way of knowing if |
Yes, that's what we should aim for. |
I'm sure there are still some corner cases we need to think through, and perhaps we even need a written-down-definition of all the runtime checks that should happen. But I can't quite get this straight in my head today, so I need to revisit this properly with Enrique for M6. |
an unknown type (force explicit specification of type args) #604
For now, I have decided to force you to explicitly specify type args instead of letting you infer a nonsense unknown type for a type argument in a generic invocation. So I think the typechecker side of this is done (for now) and we just need to make sure the backend does the right thing with switches and generic invocations. |
This is not sound:
We need to require an
else
clause.The text was updated successfully, but these errors were encountered: