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,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-03 05:30:17 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!newsfeed.freenet.de!newsfeed.stueberl.de!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: Tue, 3 Jun 2003 12:23:57 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <6a90b886.0305262344.1d558079@posting.google.com> <3ED41344.7090105@spam.com> <3ED46D81.FF62C34F@0.0> <3ED46E07.4340CABC@0.0> <3ED4F3FD.A0EF7079@alfred-hilscher.de> <6vWcnTWjF83bD0qjXTWcpA@gbronline.com> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1054643037 25714 217.17.192.37 (3 Jun 2003 12:23:57 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Tue, 3 Jun 2003 12:23:57 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:38461 Date: 2003-06-03T12:23:57+00:00 List-Id: * Preben Randhol wrote: > Lutz Donnerhacke wrote: >> Yes, that's the Ada way. But for a lot of simple functions over simple data >> types, defining such procedures is a pain. > > But if the data types are simple do you really need the optimisation? Let X in "X := X + 4;" be an complicated expression. Yes, evaluating this expression once or twice is an considerably optimisation. > If you are adding two matrixes you need to do a lot of other things > like check if they are of same dimentions etc. and you need to define > the addition so you might as well do it as a procedure over a "+" > function. We are talking about a complex expression used twice in order to perform a simple one. The function "+" itself is done on simple data types. The proposal: "<>" in the RHS of an assignment is the same as the LHS of this assignment. So the LHS determines the type and the location of each occurence of the "<>" token in the RHS expression. The process to determine the LHS for every use in this statement runs only once. So the statement: LHS := <> + any_function(<>, ...); is equivalent to: declare X : LHS'Type renames LHS; begin X := X + any_function(X, ...); end; does not aim to optimization of any simple operation on the RHS, but on the uniquess of the evaluation of the LHS for the use in the right hand expression.