Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!uupsi!kepler1!fcaggian From: fcaggian@kepler.com (Frank Caggiano) Newsgroups: comp.lang.eiffel Subject: Assertions and deferred routines Message-ID: <443@kepler1.kepler.com> Date: 17 Oct 90 18:46:06 GMT Organization: Kepler Financial Mgmt., Setuket, NY Lines: 116 According to both 'Eiffel: The language' and 'Object-oriented Software Costruction' pre and post conditions from deferred routines should be in force in any descendants. I take this to mean that if a deferred routine has a `require' statement then the conditions in the statement are enforced in the descendents WITHOUT having to explicitly re-write the statements. Is this in fact true? I still am running 2.2 B (waiting quietly for 2.3 ) and it appears not to be the case. Does anyone know if this is a know bug, am I misreading the book or am I doing something wrong. and if it is a bug is it fixed in 2.3 (and when will 2.3 be released). Here is an example of the code: -------------------------------------------------------------------------- -- Copyright (C) Kepler Financial Mgmt. -- -- 100 North Country Rd., Setauket NY, 11733 -- -- -- -- Frank Caggiano -- -- Thu Oct 11 10:54:20 EDT 1990 -- -------------------------------------------------------------------------- -- -- General notion of displaying a figure in X -- deferred class XDISPLAY_FUNCTION export display, erase feature display (fig_ref: GEN_FIGURE; w: WINDOW) is -- Display figure in window require have_figure: not fig_ref.void; window_exists: not w.void; deferred end; -- display erase (fig_ref: GEN_FIGURE; w: WINDOW) is -- Erase figure from window require have_figure: not fig_ref.void; window_exists: not w.void; deferred end; -- erase end; -- class XDISPLAY_FUNCTION In this class the assertion check does not happen unless I explicitly write out the require statement in the routine definantion. -------------------------------------------------------------------------- -- Copyright (C) Kepler Financial Mgmt. -- -- 100 North Country Rd., Setauket NY, 11733 -- -- -- -- Frank Caggiano -- -- Thu Oct 11 10:54:20 EDT 1990 -- -------------------------------------------------------------------------- -- -- class to draw an ellipse in X -- class X_DRAW_ELLIPSE export display, erase inherit XDISPLAY_FUNCTION define display,erase feature display (fig_ref: ELLIPSE; w: GRAPH_WINDOW) is external ellipse_draw language "C" do fig_ref.xgc.set_gc; ellipse_draw(w.imp_reference, fig_ref.xgc.imp_ref, fig_ref.origin.winx(w), fig_ref.origin.winy(w), (fig_ref.int_major_axis * w.draw_num) div w.draw_denom, (fig_ref.int_minor_axis * w.draw_num) div w.draw_denom); end; erase (fig_ref: ELLIPSE; w: GRAPH_WINDOW) is -- Erase ellipse from 'w'. -- NOTE: this is NOT a 'rubberband' type of erase. -- See class RUBBER and its desendents. external ellipse_draw language "C" local gc: GRAPHIC_IMP do gc.create; gc.set_background_by_pixel(w.back_color); gc.set_foreground_by_pixel(w.back_color); gc.set_gc; ellipse_draw(w.imp_reference, gc.imp_ref, fig_ref.origin.winx(w), fig_ref.origin.winy(w), (fig_ref.int_major_axis * w.draw_num) div w.draw_denom, (fig_ref.int_minor_axis * w.draw_num) div w.draw_denom); end; -- erase end; -- Frank Caggiano INTERNET: fcaggian@kepler.com Kepler Financial Management, Ltd. UUCP: ..!uunet!kepler1!fcaggian 100 North Country Rd. fax: (516) 751-8678 Sekauket, NY 11733 voice: (516) 689-6300