From: deadhacker <gstover@gmail.com>
Subject: Re: Implicit actions & program correctness
Date: Mon, 25 May 2020 13:15:57 -0700 (PDT)
Date: 2020-05-25T13:15:57-07:00 [thread overview]
Message-ID: <14afb70d-cb70-4ca2-bd24-f9d9664ee103@googlegroups.com> (raw)
In-Reply-To: <871rnk97ew.fsf@nightsong.com>
On Friday, May 15, 2020 at 3:10:02 PM UTC-7, Paul Rubin wrote:
> You might like this article (not Ada specific):
>
> http://blog.tmorris.net/posts/understanding-practical-api-design-static-typing-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 should get a compile-time type-error. In other words, calling move on inappropriate game states (i.e. move doesn’t make sense) is disallowed by the types.")
It seems that if I have a Move subprogram that operates on a Game, it & produces another Game, I don't see how it could sometimes return a FinishedGame 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?
next prev parent reply other threads:[~2020-05-25 20:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 17:45 Implicit actions & program correctness deadhacker
2020-05-15 17:55 ` deadhacker
2020-05-15 18:27 ` Nasser M. Abbasi
2020-05-15 19:01 ` Paul Rubin
2020-05-15 19:03 ` Jeffrey R. Carter
2020-05-15 20:13 ` deadhacker
2020-05-15 22:09 ` Paul Rubin
2020-05-25 20:15 ` deadhacker [this message]
2020-05-25 20:36 ` Niklas Holsti
2020-05-25 22:31 ` Paul Rubin
2020-05-26 8:47 ` Niklas Holsti
2020-05-26 9:55 ` Paul Rubin
2020-05-16 13:52 ` Brian Drummond
2020-05-16 10:10 ` Niklas Holsti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox