Golang Assert: Difference between revisions
Jump to navigation
Jump to search
Adamcolton (talk | contribs) Created page with "Inspired by [https://www.hillelwayne.com/post/theorem-prover-showdown/ this], include assert statements in Go. Something (as part of the build chain) will attempt to prove (as..." |
Adamcolton (talk | contribs) No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
Inspired by [https://www.hillelwayne.com/post/theorem-prover-showdown/ this], include assert statements in Go. Something (as part of the build chain) will attempt to prove (as in mathematically prove) that the asserts are true. I really have no idea how to approach this. | Inspired by [https://www.hillelwayne.com/post/theorem-prover-showdown/ this], include assert statements in Go. Something (as part of the build chain) will attempt to prove (as in mathematically prove) that the asserts are true. I really have no idea how to approach this. | ||
To be clear, these assertions are stripped out by the compiler, they are not run-time assertions. | |||
== Syntax == | |||
=== Comment === | |||
x := y+10 | |||
// Assert: x > y | |||
=== Const === | |||
x := y+10 | |||
const assert(x > y) | |||
=== package === | |||
import "assert" | |||
x := y+10 | |||
assert.True(x > y) | |||
== Tools == | |||
It may be helpful to provide tools. | |||
Setting axioms could be good - though also ripe for abuse. | |||
Lemmas could be useful for performance. | |||
[[Category:Code]] | [[Category:Code]] | ||
Latest revision as of 13:49, 26 April 2018
Inspired by this, include assert statements in Go. Something (as part of the build chain) will attempt to prove (as in mathematically prove) that the asserts are true. I really have no idea how to approach this.
To be clear, these assertions are stripped out by the compiler, they are not run-time assertions.
Syntax
Comment
x := y+10 // Assert: x > y
Const
x := y+10 const assert(x > y)
package
import "assert" x := y+10 assert.True(x > y)
Tools
It may be helpful to provide tools.
Setting axioms could be good - though also ripe for abuse.
Lemmas could be useful for performance.