-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save LH-Slack conversation regarding #assume: #180
Conversation
Prof. Jhala's wording makes for an especially elegant explanation of #assume. We don't want to lose it to the non-permanent nature of Slack.
af2f122
to
737cb27
Compare
@janvrany I have a vague recollection that you did a change called something like "Distinguish between assume and assert, even though this is a dummy for now" in one of "your" subsystems? I did a fresh |
``` | ||
cAssume :: b:Bool -> {v:() | b} | ||
cAssume b = if b then () else diverge() | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the risk of unleashing a wider and opinionated discussion about comments, I'd like informal explanation as well. Not being "on the forefront of formal" myself, I'd find it difficult to unrestand how to use it and what exactly is the difference (now I do, but only after previous eposure to the topic). Especially in this kind of method / API. Something along the lines of:
"
“Ensures” a postcondition `aBlock` is met. Confusingly similar to `#assert:`!
Informally, use `#assume:` in methods to ensure the method is called properly and `#assert:` to
ensure invariants during and after method execution. In other words, if `#assume:` fails it is caller's
fault whereas when `#assert:` fails it is the method's fault.
More formally (taken from Liquid Haskel slack): Just like
cAssert b
requires b as a precondition,
cAssume b
“Ensures” b as a postcondition!
In a strict language you can write
cAssume :: b:Bool -> {v:() | b}
cAssume b = if b then () else diverge()
"
@@ -5,6 +5,27 @@ Object >> K [ | |||
^[ :y | self ] | |||
] | |||
|
|||
{ #category : #'*PreSmalltalks' } | |||
Object >> assume: aBlock [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd name the parameter simply as condition
or - if you prefer - aBooleanOrBlock
because want to allow both plain Boolean
s and blocks (at the very least, to make it compatible with #assert:
Sort of. We talked about it and that resulted in janvrany/Tinyrossa#30. I did not yet started working on it. |
Ah, yes, that's it! it was exactly reading TR30 that I was trying to find. |
Wait, where did my explanation go??? |
Did the exended comment on Bohr–Sommerfeld just disappear???? |
Looks so, but I've got it.
Yes, that too. Let's leave this conversation for 2024.
OK, fine with me then. Shall I merge it then? |
Yeah let's merge it for now.
In a notification email I guess? |
Done.
Yes. |
Then maybe you can cut-and-paste that comment back here so it doesn't get lost? |
Sure, good idea:
|
Prof. Jhala's wording makes for an especially elegant explanation of #assume. We don't want to lose it to the non-permanent nature of Slack.