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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1dd28d5040ded1f8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-15 04:17:30 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!pec-10-96.tnt1.hh2.uunet.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Announce: Grace project site operational Date: Wed, 15 May 2002 13:18:55 +0200 Message-ID: <46g4eug3rl3gi6ehmbdplhorkgtgbnn39t@4ax.com> References: <3CD88FBD.4070706@telepath.com> <3CD91E31.1060004@telepath.com> <3CD94E63.3050607@mail.com> <4519e058.0205090554.1e58d951@posting.google.com> <3CE12758.18E3EC32@brighton.ac.uk> <3CE23AAF.AA6B219E@brighton.ac.uk> NNTP-Posting-Host: pec-10-96.tnt1.hh2.uunet.de (149.225.10.96) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1021461448 22187616 149.225.10.96 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:24084 Date: 2002-05-15T13:18:55+02:00 List-Id: On Wed, 15 May 2002 11:38:39 +0100, John English wrote: >"Dmitry A. Kazakov" wrote: >> >> On Tue, 14 May 2002 16:03:52 +0100, John English >> wrote: >> >> >"Dmitry A. Kazakov" wrote: >> >> >> >> Talking about next revisions and default values, there is another >> >> problem with them. How to make a default value private? Let I have >> >> some value declared in the private part and I don't want to expose it >> >> in the public part. Then there will be no way to use it as a default >> >> value in any public thing. >> > >> >Can't you use a deferred constant for your default value? >> >> It will be visible then! I want not only hide the implementation, but >> the very fact that such object exists. Let I have a type with some >> reserved values which no user-declared variable or parameter may have. >> Like "null" for pointers. Yet some subroutines could have these secret >> values as defaults for some parameters. A simple work-around is just >> to make several overloaded subroutines from them, which is clumsy. > >Hmm, if I understand what you're saying, you don't want people to >know there is a default at all (i.e. you don't want to mention it >in the visible spec). What is really wrong with something like: > > type Magic_Type is private; > Default_Value : constant Magic_Type; > procedure Foo (Magic : Magic_Type := Default_Value); > >which tells you that the parameter can be omitted because there's >a default, but you have no idea what the default actually is? Consider: type Graph_Node is private; No_Node : constant Graph_Node; -- Deferred, but visible function Get_Next_Child (Parent : Graph_Node; Child : Graph_Node := No_Node) return Graph_Node; Here I exposed No_Node, which then can be abused like: Get_Next_Child (No_Node); A solution could be some sort of incomplete declaration for subprograms: type Graph_Node is private; function Get_Next_Child (Parent : Graph_Node; Child : Graph_Node := <>) return Graph_Node; private type Graph_Node is ...; No_Node : constant Graph_Node := ...; function Get_Next_Child (Parent : Graph_Node; Child : Graph_Node := No_Node) return Graph_Node; --- Regards, Dmitry Kazakov www.dmitry-kazakov.de