Tuples, iterators, and multiple return values in Eiffel?
Loryn Jenkins:
Quote:
> 2. Franck reports that in some circumstrance calls to `f' and
> `Current.f' can execute different features. (I don't understand what
> context will cause this, though.)
That's easy:
class A ...
feature
call_a is do a; Current.a end
a is deferred ...
class AA inherit
A rename call_a as call_a1, a as a1 select call_a1, a1 end
A rename call_a as call_a2, a as a2 end
feature
a1 is ... print (1) ...
a2 is ... print (2) ...
Result with Eiffel as in ETL:
AA.call_a1 produces:
1 -- a
1 -- Current.a
AA.call_a2 produces:
2 -- a
1 -- Current.a (select-ed)
If both 'Current.a' did the same as their respective 'a' calls, it would
mean that it is possible that Current /= Current in a single object!
Quote:
> 3. Magic rebinding not intended to be deep. (! Again, something I
> don't understand.)
Separate the renames and selects page 176 in a diamond hierarchy instead
of a single class.
Quote:
> 4. It's impossible to get more than one part object.
class COMMAND ... execute is deferred ...
class MULTICOMMAND inherit
COMMAND rename execute as exec1 select exec1 end
COMMAND rename execute as exec2 end
feature
exec1 is ... implemented ...
exec2 is ... implemented ...
init is ...
something.set_command (Current) -- using exec1
other_thing.set_command (?) -- using exec2, not possible.
...
Quote:
> others over the years have posted to c.l.e., asking why their code
> wasn't working as described in ETL.
I know (it's a FAQ!). I did ask it myself too. It's not surprising that
people are puzzled by this feature, want to understand it, and find
funky things they could do with it. But it's not something you miss when
doing everyday programming. No project has been cancelled waiting for
replication to be implemented.
Quote:
> I suggest we clean this issue up, whether or not we also accept
> the ROUTINE proposal.
Indeed, removing replication under repeated inheritance is the safest
way to clean it up.
--