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: 103376,bdcca6db8294fb00 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Introducing memcache-ada, a memcached client in Ada Date: Mon, 20 Dec 2010 23:44:09 +0000 Organization: A noiseless patient Spider Message-ID: References: <4d0f1316$0$23759$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx01.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="17312"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/biJ7I/p7OUashX6ft5vlvnqgxrMN2Cek=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:z7Gss2m3l+Tt8Cz3SviH6SUVs8E= sha1:wBWkjMl3BLSLxflE0aAa7EnfzgU= Xref: g2news2.google.com comp.lang.ada:17054 Date: 2010-12-20T23:44:09+00:00 List-Id: R Tyler Croy writes: > On 2010-12-20, Simon Wright wrote: >> I think these are "symptoms" of a thin (thinnish) binding. In >> particular, the type Expiration and its use is rather non-Ada style. Is >> it really the case that the memcached server won't allow you to specify >> a retention period greater than 30 days? (just checked -- yes -- well, >> the Google Python API says "up to 1 month", close enough I suppose :-). >> >> I don't see why Set appears as two functions & one procedure? Would it >> be sensible to say, perhaps, >> >> procedure Set (....); -- no expiry specified >> >> procedure Set (....; >> Expiring_After : Duration); >> >> procedure Set (....; >> Expiring_At : Ada.Calendar.Time); > > I was concerned about "hiding" too much of how Memcached works from > the user by using "Duration" instead of the Expiration subtype that I > created. Not bad reasons. But - for thicker bindings - you do end up hiding the gory details. For instance, you could implement Expiring_After > 30 days by calculating the absolute time & passing that instead .. in fact, why not do that always? (that's how GNAT implements 'delay'). > As for the multiple overloads of Set/Get, that's to address a problem > I'm not sure has a good solution. With Memcached, and I'd assume most > other networked-services like it, there are expected error conditions > where I personally find exceptions to be unnecessary. > > To account for this, I wanted to define the function which return > booleans (perhaps a "Success", "Failure" enum would be better) in case > the caller "cared" about the success of a Set call. While still > providing a version of the same code which returns nothing, in the > case of the user "not caring" what the Set returns as long as it > doesn't except (Invalid_Key_Error for example) Pretty good reasons. An alternative might be an 'out' parameter. >> Why is type Connection tagged? I guess you have some expansion plans >> for it?! > > Because I don't know why because, I was under the impression that > tagging it was the only way to get "Connection.Get ()" style > invocations under Ada 2005 Yes, that's right. I've not got used to "Connection.Get ()" yet, explains why you called the leading parameter This! (I was wondering whether to mention it; my personal style would probably have been to name it C for Connection; or maybe To, & From for Get).