invoking methods with no inference and all default type arguments #3897
Comments
[@gavinking] Not for 1.1 |
[@gavinking] So a couple of things have come up recently which have convinced me to do something here:
Therefore, I propose to:
Everyone, WDYT? Any objections? |
[@lucaswerkmeister] Let me make sure I understood this correctly: f<Map>(); This currently means “call Map m = Map { 0->"0" }; This would not change: Both Right? |
[@gavinking] What changes is the interpretation of:
This currently means |
[@gavinking] @lucaswerkmeister, and no, your second example is completely wrong. Only the LHS is a type expression, and so for that the interpretation changes. But both before and after it is an error, since |
[@gavinking] @tombentley points out that this might affect a lot of metamodel code where I guess people tend to write |
[@FroMage] I would have kept |
[@gavinking] @FroMage Well 2 and 3, and the analogy to what we do with defaulted arguments of functions push me toward thinking it was a mistake. I mean, we don't say that |
[@quintesse] But in that last example they aren't 100% equivalent, is it? I mean we also don't write |
[@gavinking] @quintesse Wrong analogy. |
[@gavinking] I have implemented this. For now, you just get a usage warning for the old syntax, not an error. |
[@gavinking] This is done, but I still need to update the spec, |
[@gavinking] Done. |
results from an ambiguity as to the interpretation of type with no <> yet another motivation for what is proposed in #3897
[@FroMage] Support:
This was disabled by #3896 and is actually the only way to call generic methods where type inference fails without warning the user (I think there's another issue about that already) and where all type arguments have good valid defaults, rather than the wrong ones that would be inferred.
We have syntax to support using default type arguments after the first one, just not the first, which is really weird.
I suppose that if type inference would use defaulted type arguments when it can't possibly infer anything useful, that would help too.
[Migrated from ceylon/ceylon-spec#791]
[Closed at 2015-05-13 20:17:08]
The text was updated successfully, but these errors were encountered: