Skip to content
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

Merged
merged 1 commit into from
Dec 15, 2023

Conversation

shingarov
Copy link
Owner

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.

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.
@shingarov shingarov force-pushed the save-assume-comments branch from af2f122 to 737cb27 Compare December 14, 2023 05:18
@shingarov shingarov requested a review from janvrany December 14, 2023 05:20
@shingarov
Copy link
Owner Author

@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 make of latest Tinyrossa (because it pulls in "everything") and browsed for #assume: and #assert: but couldn't find it. Am I hallucinating?

```
cAssume :: b:Bool -> {v:() | b}
cAssume b = if b then () else diverge()
"
Copy link
Collaborator

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 [
Copy link
Collaborator

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 Booleans and blocks (at the very least, to make it compatible with #assert:

src/PreSmalltalks/Object.extension.st Show resolved Hide resolved
@janvrany
Copy link
Collaborator

browsed for #assume: and #assert: but couldn't find it. Am I hallucinating?

Sort of. We talked about it and that resulted in janvrany/Tinyrossa#30. I did not yet started working on it.

@shingarov
Copy link
Owner Author

that resulted in janvrany/Tinyrossa#30.

Ah, yes, that's it! it was exactly reading TR30 that I was trying to find.

@shingarov
Copy link
Owner Author

Wait, where did my explanation go???

@shingarov
Copy link
Owner Author

Did the exended comment on Bohr–Sommerfeld just disappear????

@janvrany
Copy link
Collaborator

Did the exended comment on Bohr–Sommerfeld just disappear????

Looks so, but I've got it.

I think the crux of the problem is elsewhere, namely in that right now we are writing something in-between Smalltalk-80 and Smalltalk-25.

Yes, that too. Let's leave this conversation for 2024.

I meant a much narrower scope for this PR: namely, just to save Prof. Jhala's wording somewhere before Slack eats it.

OK, fine with me then. Shall I merge it then?

@shingarov
Copy link
Owner Author

Yeah let's merge it for now.

Looks so, but I've got it.

In a notification email I guess?

@janvrany janvrany merged commit cdf1492 into pure-z3 Dec 15, 2023
3 checks passed
@janvrany
Copy link
Collaborator

Yeah let's merge it for now.

Done.

In a notification email I guess?

Yes.

@shingarov
Copy link
Owner Author

Then maybe you can cut-and-paste that comment back here so it doesn't get lost?

@janvrany
Copy link
Collaborator

Then maybe you can cut-and-paste that comment back here so it doesn't get lost?

Sure, good idea:

I meant a much narrower scope for this PR: namely, just to save Prof. Jhala's wording somewhere before Slack eats it.
As to the "risk of unleashing a wider and opinionated discussion", I think the crux of the problem is elsewhere, namely in that right now we are writing something in-between Smalltalk-80 and Smalltalk-25, akin to Bohr–Sommerfeld vector model: already not Galileo–Newton's classical physics, but not yet quantum mechanics.
I have just now created #181 to address your concerns in proper Smalltalk-25.

@shingarov shingarov deleted the save-assume-comments branch June 29, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants