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-Thread: a07f3367d7,56525db28240414a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.224.180.205 with SMTP id bv13mr11583370qab.8.1343789560294; Tue, 31 Jul 2012 19:52:40 -0700 (PDT) Received: by 10.66.85.231 with SMTP id k7mr3469355paz.38.1343789444537; Tue, 31 Jul 2012 19:50:44 -0700 (PDT) Path: a15ni14727975qag.0!nntp.google.com!4no1161811pbo.1!news-out.google.com!g9ni7594064pbo.0!nntp.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Efficient Sequential Access to Arrays Date: Fri, 27 Jul 2012 08:28:45 +0200 Organization: cbb software GmbH Message-ID: <1lqose2aygd4r$.ots4i45o7jnz.dlg@40tude.net> References: <01983f1c-f842-4b1f-a180-bcef531dad4c@googlegroups.com> <87ipdf4vh6.fsf@mid.deneb.enyo.de> <4ce44d2d-d789-42a0-a6ed-035f7f8d58be@googlegroups.com> <1d20andzhb0rk.ytxhpkza8tky$.dlg@40tude.net> <1qlao21lvhn4q.p95zkkqzzcqz$.dlg@40tude.net> <802f6aec-a448-4a41-8320-fbdb5ffa7883@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 9A8bJrx4NhDLcSmbrb6AdA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Received-Bytes: 3303 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-07-27T08:28:45+02:00 List-Id: On Thu, 26 Jul 2012 22:25:58 -0700 (PDT), Shark8 wrote: > On Thursday, July 26, 2012 12:56:49 PM UTC-6, Dmitry A. Kazakov wrote: >> On Thu, 26 Jul 2012 10:40:32 -0700 (PDT), Shark8 wrote: >> >>> On Thursday, July 26, 2012 7:46:04 AM UTC-6, Dmitry A. Kazakov wrote: >>>> >>>> Some would disagree, but IMO in a well-written Ada program you should never >>>> ever need 'Valid. Don't do Unchecked_Conversion with doubtful outcome. >>>> Don't use stream attributes for constrained types. >>> >>> It might not be avoidable though; the presence of 'Valid however does let >>> you ensure that your [sub]typing assumptions are met. >> >> These assumptions must be upheld per value construction. > > Er, yes? Your value-construction procedure, which might be a > stream-implementation, could use 'Input to ensure the data is valid, no? > Then isn't the 'Read the value-construction? Neither. If you use stream you should do it properly, i.e. as the transport layer. The transport is defined in terms of bytes, characters or other units. So the only read here might be Character'Read. > Many DBs don't support such range subtyping, so why is it "bad form" to > ensure that such values, when read (ie value construction from the > database) conform to the proper subtypes. (Though this might be done > automatically on assignment from function if it falls outside the > 'Range... I'll have to read up on when subtype constraints are applied.) When DB client does not support type mapping, you should always use the DB native type, e.g. SQLINTEGER. Ada type must be obtained from that using type conversion. Which should be obvious if we remember that Ada discourages implicit type conversions. Why a DB to Ada one should be implicit? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de