Discussion:
Creation instruction applies to target of a deferred type
Jimmy Johnson
2013-04-24 01:56:30 UTC
Permalink
Similar to my other post.

deferred class VITP_WIDGET
inherit
EV_MODEL_WORLD
feature {NONE} -- Initialization
frozen make (a_item: like vitp_item)
-- set the item, and other stuff
feature -- Access
vitp_item: VITP_ITEM


It seems the solution is similar to what I used in the other post--add bogus creation feature and redefine default create. But, this is not desired; this class should be deferred (but cannot be because I need a creation routine) and `vitp_item' is also deferred so, again, I have to create a stupid dummy object in the redefined `default_create' which should never be called!

What am I missing here?



------------------------------------
Emmanuel Stapf
2013-04-24 04:49:11 UTC
Permalink
Post by Jimmy Johnson
deferred class VITP_WIDGET
inherit
EV_MODEL_WORLD
feature {NONE} -- Initialization
frozen make (a_item: like vitp_item)
-- set the item, and other stuff
feature -- Access
vitp_item: VITP_ITEM
The solution is to undefine the feature which is creating that deferred instance
and re-implement it in the concrete descendants. This is a known issue which we
would like to see addressed in the future, but the current standard does not allow
it for the time being.

Regards,
Manu



------------------------------------
Jimmy Johnson
2013-04-24 19:52:13 UTC
Permalink
Post by Emmanuel Stapf
Post by Jimmy Johnson
deferred class VITP_WIDGET
inherit
EV_MODEL_WORLD
feature {NONE} -- Initialization
frozen make (a_item: like vitp_item)
-- set the item, and other stuff
feature -- Access
vitp_item: VITP_ITEM
The solution is to undefine the feature which is creating that deferred instance
and re-implement it in the concrete descendants. This is a known issue which we
would like to see addressed in the future, but the current standard does not allow
it for the time being.
Regards,
Manu
Not quite sure how to do this. In class EV_MODEL_GROUP, the feature seems to be `new_filled_list'. Minus the assertions and comment here it is:

new_filled_list (n: INTEGER): like Current
do
create Result.make (n)
end

How do I re-implement it in descendants? I don't know what to do with the "like Current". My class has a `make' feature with a different signature, so I don't know what to do here. Is this feature even meaningful? It seems to be used by `duplicate' from ARRAYED_LIST, but EV_MODEL_GROUP adds nothing to `duplicate'.



------------------------------------

Loading...