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-Thread: a07f3367d7,2078ce7aac45af5b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.152.109.171 with SMTP id ht11mr15136lab.2.1353486861590; Wed, 21 Nov 2012 00:34:21 -0800 (PST) Path: ha8ni3667wib.1!nntp.google.com!feeder1.cambriumusenet.nl!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!backlog2.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada202X : Adding functors Date: Wed, 14 Nov 2012 21:45:24 +0000 Organization: A noiseless patient Spider Message-ID: References: <0114d327-9f9f-4ad2-9281-56331d11a90c@googlegroups.com> <2bb9e5fa-04a2-4073-bca1-1739ce0580f1@googlegroups.com> <57bca956-2348-4825-8f5f-04fb91863696@googlegroups.com> <094f94ed-dbcc-4dba-bd9d-894a75f69037@googlegroups.com> <8373eaf3-5299-4bbb-a462-56d2d76d6333@googlegroups.com> <1na6brajyyab1.1m57ova8gzvwk$.dlg@40tude.net> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="f38d6453efa614aca652dfde0a80d954"; logging-data="21427"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18YH8rCs4ztHS4eZTGbipRGQkv0h5hTiIA=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (darwin) Cancel-Lock: sha1:IxqwocVFd4jsNeH9bSRS4pZAe4U= sha1:Mve3zWF0BCIO2+kTk3Z2T6b57Tg= X-Original-Bytes: 2396 Content-Type: text/plain Date: 2012-11-14T21:45:24+00:00 List-Id: "Dmitry A. Kazakov" writes: > On Wed, 14 Nov 2012 08:54:09 -0800 (PST), Adam Beneschan wrote: > >> A new way to write obfuscated code? > > I don't understand the point. If there is any obfuscation then on the > Ada's side which does not support straightforward declaration of > user-defined arrays/indexing operation. This is Martin's code: procedure Test is F1 : constant Algorithm := C_To_F.Create (10.0); F2 : constant Algorithm := C_To_F.Create (20.0); begin Put_Line ("F1 := " & Long_Float'Image (F1(X))); Put_Line ("F2 := " & Long_Float'Image (F2(X))); end Test; F1(X) is a user-defined array indexing which returns the Fahrenheit equivalent of the 10.0 Celsius that F1 was created with *no matter what index you supply* because the only purpose of making it look like an array indexing was to avoid making it look like what it is - a subprogram call. There may be some point in this in C++, if the templating mechanism only cares about the syntactic feature of ()-represents-invocation. I'm not sure I want to know.