comp.lang.ada
 help / color / mirror / Atom feed
* Ada Configuration API for Unix and Windows
@ 2002-12-03 16:47 Ulrich Eckhardt
  2002-12-03 21:35 ` Stephen Leake
  0 siblings, 1 reply; 10+ messages in thread
From: Ulrich Eckhardt @ 2002-12-03 16:47 UTC (permalink / raw)


Hi,

as promised some time ago, i have finished my platform independent API
for accessing configuration informations (Copyright GPL).
More infos on http://www.uli-eckhardt.de/ada_registry/

Comments and suggestion are welcome.

Uli
-- 
Ulrich Eckhardt
http://www.uli-eckhardt.de




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-03 16:47 Ada Configuration API for Unix and Windows Ulrich Eckhardt
@ 2002-12-03 21:35 ` Stephen Leake
  2002-12-03 22:29   ` Martin Dowie
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Stephen Leake @ 2002-12-03 21:35 UTC (permalink / raw)


Ulrich Eckhardt <uli.e@gmx.de> writes:

> Hi,
> 
> as promised some time ago, i have finished my platform independent API
> for accessing configuration informations (Copyright GPL).

just a nit; "GPL" is a _license_, not a _copyright_. The copyright to
this code is owned by you; you choose to release it under the GPL
license. Sometimes, this matters :). Ah, you do have this right on the
web page.

> More infos on http://www.uli-eckhardt.de/ada_registry/

In an example, you have:

  Put(reg,To_Key("A_Key"),"A Value"); -- A Key in the default section
  
Why is the conversion To_Key necessary? Surely it could be done by Put?

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-03 21:35 ` Stephen Leake
@ 2002-12-03 22:29   ` Martin Dowie
  2002-12-03 22:57     ` Stephen Leake
  2002-12-04  9:27   ` Ulrich Eckhardt
  2002-12-05  8:43   ` Victor Porton
  2 siblings, 1 reply; 10+ messages in thread
From: Martin Dowie @ 2002-12-03 22:29 UTC (permalink / raw)


"Stephen Leake" <Stephen.A.Leake@nasa.gov> wrote in message
news:uadjmvl9m.fsf@nasa.gov...
> In an example, you have:
>
>   Put(reg,To_Key("A_Key"),"A Value"); -- A Key in the default section
>
> Why is the conversion To_Key necessary? Surely it could be done by Put?

I'm guessing but it could be to ensure the user has a second look and
doesn't
get their 'keys' and 'values' the wrong way round (as both would be
strings)...

...or it could just be an oversight! :-)







^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-03 22:29   ` Martin Dowie
@ 2002-12-03 22:57     ` Stephen Leake
  2002-12-04 13:09       ` Martin Dowie
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Leake @ 2002-12-03 22:57 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@no.spam.btopenworld.com> writes:

> "Stephen Leake" <Stephen.A.Leake@nasa.gov> wrote in message
> news:uadjmvl9m.fsf@nasa.gov...
> > In an example, you have:
> >
> >   Put(reg,To_Key("A_Key"),"A Value"); -- A Key in the default section
> >
> > Why is the conversion To_Key necessary? Surely it could be done by Put?
> 
> I'm guessing but it could be to ensure the user has a second look and
> doesn't
> get their 'keys' and 'values' the wrong way round (as both would be
> strings)...

Hmph. That's what named association is for:

Put (reg, Key => "A_Key", Value => "A Value");

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-03 21:35 ` Stephen Leake
  2002-12-03 22:29   ` Martin Dowie
@ 2002-12-04  9:27   ` Ulrich Eckhardt
  2002-12-04 13:49     ` Stephen Leake
  2002-12-05  8:43   ` Victor Porton
  2 siblings, 1 reply; 10+ messages in thread
From: Ulrich Eckhardt @ 2002-12-04  9:27 UTC (permalink / raw)


Stephen Leake wrote:
> Ulrich Eckhardt <uli.e@gmx.de> writes:

> just a nit; "GPL" is a _license_, not a _copyright_. The copyright to

Hi,

thanks, i will have a look on this.

> In an example, you have:
> 
>   Put(reg,To_Key("A_Key"),"A Value"); -- A Key in the default section
>   
> Why is the conversion To_Key necessary? Surely it could be done by Put?

I have decided to introduce special types for sections and values,
so that the user can not accidentialy permute sections and keys or
other unbounded strings, specialy when variables are used (and not
simple string literals like in the example).

Uli
-- 
Ulrich Eckhardt
http://www.uli-eckhardt.de




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-03 22:57     ` Stephen Leake
@ 2002-12-04 13:09       ` Martin Dowie
  0 siblings, 0 replies; 10+ messages in thread
From: Martin Dowie @ 2002-12-04 13:09 UTC (permalink / raw)


Stephen Leake <Stephen.A.Leake@nasa.gov> wrote in message news:<usmxeu2vd.fsf@nasa.gov>...
> > I'm guessing but it could be to ensure the user has a second look and
> > doesn't
> > get their 'keys' and 'values' the wrong way round (as both would be
> > strings)...
> 
> Hmph. That's what named association is for:
> 
> Put (reg, Key => "A_Key", Value => "A Value");

Yes, but I still find some engineers who don't use it.
Presumably as it it more typing for their fingers!
Never mind the how useful the feature is. :-(

Perhaps this wasn't the reason, I was just guessing
after all.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-04  9:27   ` Ulrich Eckhardt
@ 2002-12-04 13:49     ` Stephen Leake
  2002-12-04 14:20       ` Ulrich Eckhardt
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Leake @ 2002-12-04 13:49 UTC (permalink / raw)


Ulrich Eckhardt <uli.e@gmx.de> writes:

> Stephen Leake wrote:
> > In an example, you have:
> >   Put(reg,To_Key("A_Key"),"A Value"); -- A Key in the default section
> >   Why is the conversion To_Key necessary? Surely it could be done by
> > Put?
> 
> I have decided to introduce special types for sections and values,
> so that the user can not accidentialy permute sections and keys or
> other unbounded strings, specialy when variables are used (and not
> simple string literals like in the example).

That seems to make sense at first, but just gets in the way in the
long run. A string is a string. Named association is a better
solution. 

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-04 13:49     ` Stephen Leake
@ 2002-12-04 14:20       ` Ulrich Eckhardt
  0 siblings, 0 replies; 10+ messages in thread
From: Ulrich Eckhardt @ 2002-12-04 14:20 UTC (permalink / raw)


Stephen Leake wrote:
> Ulrich Eckhardt <uli.e@gmx.de> writes:
>>I have decided to introduce special types for sections and values,
>>so that the user can not accidentialy permute sections and keys or
>>other unbounded strings, specialy when variables are used (and not
>>simple string literals like in the example).
> 
> That seems to make sense at first, but just gets in the way in the
> long run. A string is a string. Named association is a better
> solution. 

You can use named associations, but you don't have to use them.
Also they do not prevent to use accidentialy a wrong variable.

Assume you have some sort of ugly code like

ak : Constant r_key := To_Key("A_Key");
as : Constant r_section := To_Section("A_Section");
..

Set_Section(reg,ak);
Put(reg,as,"A Value");

Named association may not help in this case, since the user
has accidentialy permutet the use of this variables. However,
since i have extra types, the compiler will find this error.

Of course, the above example is constructed, but sometimes you
may have some complicated data structures lists etc ...

Uli
-- 
Ulrich Eckhardt
http://www.uli-eckhardt.de




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
@ 2002-12-05  6:10 Grein, Christoph
  0 siblings, 0 replies; 10+ messages in thread
From: Grein, Christoph @ 2002-12-05  6:10 UTC (permalink / raw)


> > >   Put(reg,To_Key("A_Key"),"A Value"); -- A Key in the default section
> > >   Why is the conversion To_Key necessary? Surely it could be done by
> > > Put?
> > 
> > I have decided to introduce special types for sections and values,
> > so that the user can not accidentialy permute sections and keys or
> > other unbounded strings, specialy when variables are used (and not
> > simple string literals like in the example).
> 
> That seems to make sense at first, but just gets in the way in the
> long run. A string is a string. Named association is a better
> solution. 

declare
  -- type T is new String;  or alternatively
  type T is array (Positive range <>) of Character;
  procedure P (L: T; R: String) is
  begin
    null;
  end P;
begin
  P ("AAA", "BBB");      -- legal
  P (T'("AAA"), "BBB");  -- legal
  P (T("AAA"), "BBB");   -- illegal (type of "AAA" can not be determined)
end;

So again: Why is the conversion necessary?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ada Configuration API for Unix and Windows
  2002-12-03 21:35 ` Stephen Leake
  2002-12-03 22:29   ` Martin Dowie
  2002-12-04  9:27   ` Ulrich Eckhardt
@ 2002-12-05  8:43   ` Victor Porton
  2 siblings, 0 replies; 10+ messages in thread
From: Victor Porton @ 2002-12-05  8:43 UTC (permalink / raw)


In article <903lsa-l91.ln@uli.uli-eckhardt.de>,
	Ulrich Eckhardt <uli.e@gmx.de> writes:
> Stephen Leake wrote:
>> Ulrich Eckhardt <uli.e@gmx.de> writes:

> ak : Constant r_key := To_Key("A_Key");
> as : Constant r_section := To_Section("A_Section");

Well, better Key_Type("A_Key") and Section_Type("A_Section"),
it is less confusing and error-prone (no overloaded functions)
as is straight usage of type conversions, not anti-intuitive
(as shown by previous discussion) functions.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-12-05  8:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-03 16:47 Ada Configuration API for Unix and Windows Ulrich Eckhardt
2002-12-03 21:35 ` Stephen Leake
2002-12-03 22:29   ` Martin Dowie
2002-12-03 22:57     ` Stephen Leake
2002-12-04 13:09       ` Martin Dowie
2002-12-04  9:27   ` Ulrich Eckhardt
2002-12-04 13:49     ` Stephen Leake
2002-12-04 14:20       ` Ulrich Eckhardt
2002-12-05  8:43   ` Victor Porton
  -- strict thread matches above, loose matches on Subject: below --
2002-12-05  6:10 Grein, Christoph

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