Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

We don't really understand it, so we'll give it to the programmers.


devel / comp.lang.ada / Re: Looking for feedback: ISO 3166-1 country Country Code Reference in Ada

SubjectAuthor
* Looking for feedback: ISO 3166-1 country Country Code Reference in AdaA.J.
`- Re: Looking for feedback: ISO 3166-1 country Country Code ReferenceJeffrey R.Carter

1
Looking for feedback: ISO 3166-1 country Country Code Reference in Ada

<1fdb945b-fc6d-41dd-9c27-41a7fe9019fdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9504&group=comp.lang.ada#9504

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:1828:b0:3e6:457f:9ed1 with SMTP id t40-20020a05622a182800b003e6457f9ed1mr3089747qtc.5.1681584729285;
Sat, 15 Apr 2023 11:52:09 -0700 (PDT)
X-Received: by 2002:a25:d290:0:b0:b92:3804:de42 with SMTP id
j138-20020a25d290000000b00b923804de42mr681679ybg.10.1681584728968; Sat, 15
Apr 2023 11:52:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 15 Apr 2023 11:52:08 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=68.163.48.153; posting-account=es6tdQoAAABG0JD-zg4XEg34h5fepyKP
NNTP-Posting-Host: 68.163.48.153
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1fdb945b-fc6d-41dd-9c27-41a7fe9019fdn@googlegroups.com>
Subject: Looking for feedback: ISO 3166-1 country Country Code Reference in Ada
From: ianozia@gmail.com (A.J.)
Injection-Date: Sat, 15 Apr 2023 18:52:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: A.J. - Sat, 15 Apr 2023 18:52 UTC

I just created a library for accessing ISO 3166-1 records in Ada compatible with Ada.Locales. Before I try to publish it to Alire, I'm hoping to get some feedback if anyone has some. It's possible that feedback will result in the function calls, naming convention, or structure being set up differently, so please let me know what you think.

https://github.com/AJ-Ianozi/iso_3166

I also posted this on the subreddit, so apologies for any redundancy for those viewing both!

Re: Looking for feedback: ISO 3166-1 country Country Code Reference in Ada

<u1j3vm$2va2c$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9506&group=comp.lang.ada#9506

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Looking for feedback: ISO 3166-1 country Country Code Reference
in Ada
Date: Mon, 17 Apr 2023 11:36:53 +0200
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <u1j3vm$2va2c$1@dont-email.me>
References: <1fdb945b-fc6d-41dd-9c27-41a7fe9019fdn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 17 Apr 2023 09:36:54 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="27767de2b3a2081c8e0f533e25867ae7";
logging-data="3123276"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hwa86x8IaWiHDBzVPXCsNdDmd211fUTg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Cancel-Lock: sha1:ZkVJy9VqG0VoUyKCIHnKMY3OBdA=
In-Reply-To: <1fdb945b-fc6d-41dd-9c27-41a7fe9019fdn@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Mon, 17 Apr 2023 09:36 UTC

On 2023-04-15 20:52, A.J. wrote:
> I just created a library for accessing ISO 3166-1 records in Ada compatible with Ada.Locales. Before I try to publish it to Alire, I'm hoping to get some feedback if anyone has some. It's possible that feedback will result in the function calls, naming convention, or structure being set up differently, so please let me know what you think.
>
> https://github.com/AJ-Ianozi/iso_3166

Some initial thoughts on what you have:

It seems likely that your clients will use the alpha codes for input and
display. It will be more convenient for that if the alpha codes are subtypes of
String rather than distinct types.

Since you have already enumerated all 250 possible alpha codes, your predicates
could look like

subtype Alpha_Code_2 is String (1 .. 2) with
Dynamic_Predicate => Alpha_Code_2 in "AF" | "AL" | ...;

and similar for the 3-letter codes.

Since you have already enumerated all 250 possible numeric codes, you could use
a restricted range for your numeric (sub)type, with a predicate restricting it
to valid values.

These use the language to do validity checking for you.

Regarding the design of such a pkg, my initial instinct was to use enumeration
types for the alpha codes, but a little investigation shows that some of the
codes are Ada reserved words, so that doesn't work. So I would stick with the
String subtypes and provide functions such that, given one of the values, the
client can obtain the others, as well as the name. Alternatively, one could have
functions to return a record such as you provide. Which is preferable depends on
how such a pkg is typically used.

There are various possible implementations, with different tradeoffs.

--
Jeff Carter
"He nevere yet no vileynye ne sayde
In al his lyf unto no maner wight."
Canterbury Tales
156

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor