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,8276b2994037cd71 X-Google-Attributes: gid103376,public From: Lao Xiao Hai Subject: Re: disjoint ranges ? Date: 2000/10/17 Message-ID: <39ED29F2.8615D8EA@ix.netcom.com>#1/1 X-Deja-AN: 682734619 Content-Transfer-Encoding: 7bit References: <39E612C9.9BF98CD3@laas.fr> <8s59nu$ej4$1@news.huji.ac.il> <39E658A4.525AE881@acm.org> <39E6E890.3B13E7A9@laas.fr> <8s8iuk$q66$1@nnrp1.deja.com> <39EBB984.F2F8905F@ix.netcom.com> X-Accept-Language: en X-Server-Date: 18 Oct 2000 04:47:10 GMT Content-Type: text/plain; charset=us-ascii Organization: MindSpring Enterprises Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-10-18T04:47:10+00:00 List-Id: Robert A Duff wrote: > Lao Xiao Hai writes: > > > So, making a feature more powerful might be something such as being > > able to overload the "in" membership test. > > It might be in the abstract, but in the context of Ada, probably not. > > >... For some reason, this > > operator is not really a first class operator in Ada. I have often > > wondered about the rationale for that decision. > > What is the type of the right-hand side of "in" here: > > if X in Integer range 1..10 ... > > ? Ada has no way of describing that type. In order to make "in" a > normal operator, we would need to invent a way to pass types as > parameters, and talk about the type of a type (and subtypes). This is > not entirely unreasonable in the abstract, but it would be an enormous > change to Ada. > > Consider: > > type T is range 1..100; > function "in"(X: T; Y: type-of-T?) return Boolean; > > Or maybe it should be T'in? Anyway, it raises all kinds of questions. > What *is* the range of T (given that "in" changes it)? I see your point about the magnitude of the change required to pass a type as a parameter. I suppose I did not think this through as carefully as I should have. Still, it would be nice to be able to do something like this. On the other hand. I don't think there is much virtue in making wrenching changes in the language design. Thanks, Richard