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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:620a:1366:: with SMTP id d6mr28349065qkl.114.1590437758395; Mon, 25 May 2020 13:15:58 -0700 (PDT) X-Received: by 2002:aca:88c:: with SMTP id 134mr7493114oii.99.1590437758049; Mon, 25 May 2020 13:15:58 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.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: Mon, 25 May 2020 13:15:57 -0700 (PDT) In-Reply-To: <871rnk97ew.fsf@nightsong.com> Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=76.121.70.69; posting-account=pQzPUgkAAAAOiiJHd16-n1B6leDCaI3_ NNTP-Posting-Host: 76.121.70.69 References: <3c545096-d000-4d09-b3fe-ad8530632457@googlegroups.com> <871rnk97ew.fsf@nightsong.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <14afb70d-cb70-4ca2-bd24-f9d9664ee103@googlegroups.com> Subject: Re: Implicit actions & program correctness From: deadhacker Injection-Date: Mon, 25 May 2020 20:15:58 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:58787 Date: 2020-05-25T13:15:57-07:00 List-Id: On Friday, May 15, 2020 at 3:10:02 PM UTC-7, Paul Rubin wrote: > You might like this article (not Ada specific): >=20 > http://blog.tmorris.net/posts/understanding-practical-api-design-static-t= yping-and-functional-programming/ Paul, thank you so much for the link. It's good reading. To me, seems that his third requirement is the tough one. (Quoting it here= : "If I call move on a tic-tac-toe board, but the game has finished, I shou= ld get a compile-time type-error. In other words, calling move on inappropr= iate game states (i.e. move doesn=E2=80=99t make sense) is disallowed by th= e types.") It seems that if I have a Move subprogram that operates on a Game, it & pro= duces another Game, I don't see how it could sometimes return a FinishedGam= e that can be detected at compile-time. (It could return a Game that could= be checked for Finished at run-time.) Sadly, his Java API is no longer available, so I can't see how he solved it= . Do you (or anyone else here) know how it could be solved with Ada?