Difference between revisions of "Talk:Catcall checkpoints"
Peter gummer (Talk | contribs) m |
|||
Line 1: | Line 1: | ||
--[[User:Peter gummer|Peter gummer]] 10:54, 3 July 2007 (CEST) It is annoying that, in order to solve the catcall problem, we have to forbid polymorphic assignments like <e>list_of_any := list_of_string</e>. Yes, we don't want integers poked into <e>list_of_any</e> when it's attached to a list of strings; but usually when we perform such assignments it's so that we can use the list in a read-only fashion. I would prefer to allow such assignments, if and only if the entity on the left is declared '''read-only'''. ''Uh oh'', now I've gone and raised the old question, "C++ has ''const'' so why doesn't Eiffel?" | --[[User:Peter gummer|Peter gummer]] 10:54, 3 July 2007 (CEST) It is annoying that, in order to solve the catcall problem, we have to forbid polymorphic assignments like <e>list_of_any := list_of_string</e>. Yes, we don't want integers poked into <e>list_of_any</e> when it's attached to a list of strings; but usually when we perform such assignments it's so that we can use the list in a read-only fashion. I would prefer to allow such assignments, if and only if the entity on the left is declared '''read-only'''. ''Uh oh'', now I've gone and raised the old question, "C++ has ''const'' so why doesn't Eiffel?" | ||
+ | |||
+ | '''--[[User:Juliant|Juliant]] 00:32, 4 July 2007 (CEST)''': | ||
+ | The assignment has to be disallowed with ''default semantics''. A good solution will allow exactly what you say, an easy way to declare a read-only list. For example the [[usage-site variance]] would allow to declare a list as <e>LIST [+ANY]</e> to mark it read-only. | ||
+ | |||
+ | The last ECMA meeting proposed a new solution but we didn't get the validity rules yet, so we don't have a wiki-page for this at the moment. We will add this when we get them and then we can see how it works there. |
Latest revision as of 13:32, 3 July 2007
--Peter gummer 10:54, 3 July 2007 (CEST) It is annoying that, in order to solve the catcall problem, we have to forbid polymorphic assignments like list_of_any := list_of_string
. Yes, we don't want integers poked into list_of_any
when it's attached to a list of strings; but usually when we perform such assignments it's so that we can use the list in a read-only fashion. I would prefer to allow such assignments, if and only if the entity on the left is declared read-only. Uh oh, now I've gone and raised the old question, "C++ has const so why doesn't Eiffel?"
--Juliant 00:32, 4 July 2007 (CEST):
The assignment has to be disallowed with default semantics. A good solution will allow exactly what you say, an easy way to declare a read-only list. For example the usage-site variance would allow to declare a list as LIST [+ANY]
to mark it read-only.
The last ECMA meeting proposed a new solution but we didn't get the validity rules yet, so we don't have a wiki-page for this at the moment. We will add this when we get them and then we can see how it works there.