From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a187c77b231bfca6 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: access to subprogram disciminants Date: 1996/04/27 Message-ID: <4lrriv$as3@news1.delphi.com>#1/1 X-Deja-AN: 151631163 organization: Delphi Internet Services Corporation newsgroups: comp.lang.ada Date: 1996-04-27T00:00:00+00:00 List-Id: main_window : frame_windows ... car_list : listboxes(main_window'access, ... The problem is that I want to make sure that CreateWindow has been called for main_window before car_list is used, and I want a compilation error if that isn't the case. The only way I can see to accomplish that is to make the declaration of main_window somehow call CreateWindow. That could be done either with an initialization procedure, or by forcing the user to call a function assigning a value: main_window : frame_windows:=create(various parameters); But the function option is not available if frame_windows is limited. So I'm back to a 'procedure initialize' which calls CreateWindow. Now it could make that call with default values for position, size, title, wndproc, and everything else and expect the user to make a later procedure call or calls to change those to real values, or it could get their values from discriminants 'initial_width, initial_title' etc. (Some of which can have default values, of course.) The latter seems simpler to me. I admit here to a personal preference for stack order rather than heap order creation/destruction of things unless lifetime requirements or something really require random heap order. It tends to keep things more orderly and in this case, given that a window can be minimized or hidden, it doesn't seem to prevent any needed flexibility. Putting the CreateWindow call in the declarations, rather than some arbitrary place in the sequence of statements, fits that policy even if there were no listboxes etc.