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: 103376,bdcca6db8294fb00 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news2.glorb.com!news-xfer.nntp.sonic.net!posts.news.sonic.net!nnrp0.nntp.sonic.net!not-for-mail Newsgroups: comp.lang.ada From: R Tyler Croy Subject: Re: Introducing memcache-ada, a memcached client in Ada References: <4d0f1316$0$23759$14726298@news.sunsite.dk> <4d0f1ed7$0$6990$9b4e6d93@newsspool4.arcor-online.net> Reply-To: R Tyler Croy User-Agent: slrn/0.9.9p1 (Linux) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID: Date: 20 Dec 2010 20:14:12 GMT Organization: Sonic.Net NNTP-Posting-Date: 20 Dec 2010 20:14:12 GMT NNTP-Posting-Host: 1eb8a5d5.news.sonic.net X-Trace: DXC=_7Kh]FmDVn7;3N:jJ^@Go;m4K\QM1CV^01OYf0H`?;X1IdCan0RDo90]C\c48cD:I;iPfIoOdF@g0H5I[4hlS>]6 X-Complaints-To: abuse@sonic.net Xref: g2news2.google.com comp.lang.ada:17045 Date: 2010-12-20T20:14:12+00:00 List-Id: On 2010-12-20, Georg Bauhaus wrote: > On 20/12/2010 09:25, Thomas Løcke wrote: >> I do though have four suggestions: >> >> 1. Declare all the string literals ("STORED", "NOT_FOUND" and such) as >> constants in the specification. > > Not sure why should they be public? These are protocol words > that I think a user will not want to deal with. > >> 3. Take a look at the various search subprograms in Ada.Strings.Fixed >> and Ada.Strings.Unbounded. Some of them might be able to replace a loop >> here or there. > > Key string scanning looks just right as is to me where, > e.g., Is_Control is used, when verbiage will otherwise > be needed to pack every pattern into one object suitable > for Index. > > You could say > > Key_Ch = ' ' > in place of > Character'Pos (Key_Ch) = 32 > > or use the white space characterising functions (like you > used is_control), or exclude everything with a lower 'Pos > if memcached wants this. > > I'd add an occasional "constant" to the String objects' > declarations in the declare blocks. Compiler option > -gnatwa warns about this and other issues. > > One more general comment, addressed to all interested: > Don't we have a portable POSIX socket library? As much as I'm > fond of GNAT, placing GNAT's helpful, yet compiler specific > libraries in every program will make them non-Ada (in a > portability sense). In the case of sockets, I don't see a > compelling need to be compiler specific? > I was thinking about this last night to be honest, I felt somewhat frustrated with all the GNAT-specific calls I had in the code base. There is the adasockets library but when I was starting out I was a little apprehensive abvout including a third-party dependency (I don't know what other compilers somebody might want to use). Not sure what the best solution is, but I can relate to your feelings towards compiler-specific functionality. -- - R. Tyler Croy -------------------------------------- Code: http://github.com/rtyler Chatter: http://twitter.com/agentdero http://identi.ca/dero