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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,73cb216d191f0fef X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.175.65 with SMTP id w1mr5510803qaz.7.1363413122676; Fri, 15 Mar 2013 22:52:02 -0700 (PDT) X-Received: by 10.50.186.133 with SMTP id fk5mr601407igc.0.1363413122634; Fri, 15 Mar 2013 22:52:02 -0700 (PDT) Path: k8ni188qas.0!nntp.google.com!dd2no1798223qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 15 Mar 2013 22:52:02 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 References: <8klywqh2pf$.1f949flc1xeia.dlg@40tude.net> <513f6e2f$0$6572$9b4e6d93@newsspool3.arcor-online.net> <513faaf7$0$6626$9b4e6d93@newsspool2.arcor-online.net> <51408e81$0$6577$9b4e6d93@newsspool3.arcor-online.net> <11rcs3gg4taww$.bylek8fsshyz$.dlg@40tude.net> <99929f93-b80f-47c3-8a37-c81002733754@googlegroups.com> <87ec4b1d-f7cd-49a4-8cff-d44aeb76a1ad@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <78103a2f-5d19-4378-b211-1917175d5694@googlegroups.com> Subject: Re: Is this expected behavior or not From: Shark8 Injection-Date: Sat, 16 Mar 2013 05:52:02 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2013-03-15T22:52:02-07:00 List-Id: On Friday, March 15, 2013 3:46:26 PM UTC-6, Robert A Duff wrote: > "Randy Brukardt" writes: >=20 > > "Shark8" wrote in message=20 > > news:87ec4b1d-f7cd-49a4-8cff-d44aeb76a1ad@googlegroups.com... > > ... > >> Hm, true; speaking of object-attributes I sometimes [though not too of= ten] > >> wish I could write something like: > >> Procedure X( Input : Some_Type ) is > >> Temp : Input'Type :=3D Some_Value; > >> begin > >> -- Whatever needs done. > >> end X; > >> > >> Is there any reason that should be disallowed / would be difficult for= =20 > >> compiler-writers to implement? > > > > I've occassionally had such a thought, too. >=20 > Me, too. (I also agree with Shark8's "not too often" comment.) >=20 >=20 > Many languages allow the type of an object to be deduced from > its initial value. I believe C++ recently added that feature, > using the "auto" keyword (which it inherited from C, and meant > something completely different -- and completely useless). > Ada allows that in a small way -- named numbers. This isn't _quite_ the same, it's declaring an object to be of the same typ= e as some other (and already known) object. > >... Probably the reason this doesn't=20 > > exist is that Ada 83 didn't have type-valued attributes and thus it was= n't=20 > > considered there. >=20 > I suspect the reason was that the designers of Ada 83 thought that > types of things ought to be explicit. Except for named numbers -- > consistency wasn't their strong suit. I thought that named numbers were of the Universal_Integer (if integral) or= Universal_Float_and_Fixed if not... of course that could just be an incorr= ect notion I've developed. >=20 > > 83). There would potentially be a cost to an object attribute vs. using= the > > subtype name directly, in that the prefix would have to be evaluated (w= hich, > > if it included function calls or checks, would generate some code). >=20 > Such cases could be forbidden. True; but there could be some more interesting cases, say, for Ada 2020. Something like: Abstract Type UNIVERSAL_STRING(Element : UNIVERSAL_CHARACTER) is=20 Array(Positive Range <>) of Element'Type; {Or something similar; if we did that we could conceivably be able to fold = Strings, Wide_Strings, and Wide_Wide_Strings together having those packages= in essence become instances of a GENERIC_STRING package... it would likely= have a monstrous amount of parameters, for functions like To_Upper and To_= Lower.} > > It's not clear that there is any problem here, it's just that we haven'= t=20 > > considered it and usually that means there is a problem there. :-) Coul= d=20 > > just be FUD, too. >=20 > Well, a bit of FUD is often appropriate in language design. ;-) This is very true; though given the haphazard approach some languages have = to design *cough*PHP*cough* one might be tempted to think there's no though= t given to design at all.