comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex R. Mosteo" <devnull@mailinator.com>
Subject: Re: SOCI-Ada: The Database Access Library for Ada
Date: Fri, 08 Aug 2008 15:47:39 +0200
Date: 2008-08-08T15:47:39+02:00	[thread overview]
Message-ID: <6g313lFe18jnU1@mid.individual.net> (raw)
In-Reply-To: 21f1f8b4-8e25-4b3f-90fa-004595237c1a@e39g2000hsf.googlegroups.com

Maciej Sobczak wrote:

> On 7 Sie, 17:10, "Alex R. Mosteo" <devn...@mailinator.com> wrote:
> 
>> As for comments for improvement, after a quick read I would like to see one
>> example on how to use pooled connections.
> 
> You can find it in the test program that is included as part of the
> package (the archive, not the Ada one :-) ).
> I have decided not to include the connection pool example in the
> "idioms" part, because connection pools are usually needed in bigger
> contexts and the simple example would be artificial - whereas other
> examples still make sense, even in such short forms.
> 
> I will think about some reasonable example for connection pools.
> Again, one is in the test program - it is the last test.
> 
>> Another thing is that in C++ there's mimicking of embedded SQL using the
>> "<<" operator. Can't this be to some extent emulated in Ada with some
>> operator overloading?
> 
> I think that the design of the library, including its syntax, needs to
> reflect the general spirit of the community that is going to use it.
> 
> For example, I find it quite easy to sell this:
> 
> int count;
> sql << "select count(*) from persons", into(count);
> 
> to C++ programmers - for one thing, it looks like streams and indeed
> streams can be involved to format parts of the query and in general
> the whole statement looks "cool".
> An important factor here is that there are lots of C++ libraries that
> use operator overloading extensively (including the standard library!)
> and that's why C++ programmers can accept this technique even on the
> border of abuse.
> Please see this page:
> 
> http://soci.sourceforge.net/doc/rationale.html
> 
> for the rationale of different syntax elements in C++.
> 
> Contrary to the above, I think that Ada programmers would find such
> syntax "a bit" overboard.
> I have decided not to stress the audience with any operator
> overloading and provide the "classical" interface that is in line with
> the interfaces of other Ada libraries - in particular the standard
> library.

I see your reasoning, and I agree it's a good idea to adapt to the particular
culture surrounding a language, albeit I'm not so sure what's a "valid" Ada
way. For me, as long as there are no pointers around, it's kinda enough. 

Of course, one can have it in several ways ;) (obviously it requires more
work). I personally don't mind some operator overloading in well-defined
contexts, where there's no risk of confusion. Take a look for example at
Gnat.Spitbol.Patterns, where "&", "*" and "**" are used to great effect: at
first it was a bit surprising but then it is really comfortable. In your case
it wouldn't feel wrong to me, because it's done for a very specific purpose.

In any case we are now icing the cake; I guess that these kinds of high-level
pieces can arrive at a later date if someone has the motivation to contribute
them. If I were idle, for example, I'd like some controlled type for
automatically scoped transactions, and a matrix view of results. I always end
implementing something like that.

I have a small project with only a few database queries that now are really
ugly (because the library I'm using can't bind vars to values and thus there's
a lot of string concatenation). It would be a good opportunity for me to clean
it up and get a feel for SOCI; I'll tell you how it goes if I do it.




  reply	other threads:[~2008-08-08 13:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-07  9:18 SOCI-Ada: The Database Access Library for Ada Maciej Sobczak
2008-08-07 15:10 ` Alex R. Mosteo
2008-08-07 15:43   ` Maciej Sobczak
2008-08-08 13:47     ` Alex R. Mosteo [this message]
2008-08-08 15:31       ` Maciej Sobczak
2008-08-19  9:01         ` Alex R. Mosteo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox