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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d534ed04fa87be8b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-24 03:16:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!fr.clara.net!heighliner.fr.clara.net!deine.net!fu-berlin.de!uni-berlin.de!dialin-145-254-040-172.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Discriminant name must be alone Date: Tue, 24 Dec 2002 12:16:50 +0100 Organization: At home Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-040-172.arcor-ip.net (145.254.40.172) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1040728589 5928256 145.254.40.172 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:32279 Date: 2002-12-24T12:16:50+01:00 List-Id: Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> There is a third answer: "user-defined constructors". > > What do you mean by "user-defined constructors"? How do they differ > from functions? A function returns some object. To use it you must have an assignment. This would not work for limited types. A constructor returns nothing. For type Buffer (Length : Positive) is ...; Buffer (*) could be viewed as a "call to constructor". Constructor works even if Buffer is limited: X : Buffer (12); > And how do they allow nested constraints to depend > upon arbitrary expressions involving discriminants? Presently we have only predefined "constructors" with the parameters = discriminats. Let we have an ability to define a constructor with other parameters. Then it would evaluate the discriminants from that parameters. Further, a discriminated type could be declared with <> as the discriminant to hide the true disriminants in the private part making them an implementation detail. I have a vague idea how to provide constructors for Ada, but I rather start a separate thread for it. -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de