Skip to content

Create typestate.md#100

Draft
dgunay wants to merge 12 commits into
rust-unofficial:mainfrom
dgunay:patch-1
Draft

Create typestate.md#100
dgunay wants to merge 12 commits into
rust-unofficial:mainfrom
dgunay:patch-1

Conversation

@dgunay

@dgunay dgunay commented Aug 17, 2020

Copy link
Copy Markdown

Neat pattern for Rust that lets you encode valid/invalid states using the type system.

dgunay added 2 commits August 17, 2020 02:27
Neat pattern for Rust that lets you encode valid/invalid states using the type system.
Formatting and minor clarifications.
@dgunay

dgunay commented Aug 19, 2020

Copy link
Copy Markdown
Author

It may be more idiomatic to call these "session types", but the article I referenced calls them typestates.

@dgunay

dgunay commented Oct 2, 2020

Copy link
Copy Markdown
Author

Is this repo still maintained? @lambda-fairy

@lambda-fairy

Copy link
Copy Markdown
Collaborator

Not really. I think this repo needs someone with time & a vision to make it useful.

@simonsan simonsan added C-addition Category: Adding new content, something that didn't exist in the repository before S-review Status: A PR that is currently under review or where a review is the next step labels Dec 31, 2020
@simonsan

simonsan commented Jan 1, 2021

Copy link
Copy Markdown
Collaborator

@dgunay Hey, thank you for your contribution! Could you please rebase your branch on master please and link typestate.md in SUMMARY.md? We'll review this PR the upcoming days.

@simonsan

simonsan commented Jan 3, 2021

Copy link
Copy Markdown
Collaborator

Status: I wrote the author an email, if he is fine with us taking some of his content and if he could relicense it and state it here somewhere in the repository. Until then we'll need to wait.

@simonsan simonsan added C-waiting for Category: Waiting for feedback of the initial author or some external dependency/issue and removed S-review Status: A PR that is currently under review or where a review is the next step labels Jan 3, 2021
Comment thread patterns/typestate.md
@dgunay

dgunay commented Jan 4, 2021

Copy link
Copy Markdown
Author

@dgunay Hey, thank you for your contribution! Could you please rebase your branch on master please and link typestate.md in SUMMARY.md? We'll review this PR the upcoming days.

Hi, thank you @simonsan. I am currently unfamiliar with how to do rebases (have never done them yet). I see you merged master into patch-1 - do I still need to do anything?

@pickfire

pickfire commented Jan 4, 2021

Copy link
Copy Markdown
Contributor
git fetch
git rebase origin/master
... edit if there are confilcts
git add ...
git rebase --continue  # do this as many times as needed
git push -f

@simonsan simonsan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small review while waiting on feedback from the author of the blog post.

Comment thread patterns/typestate.md Outdated
Comment thread patterns/typestate.md Outdated
Comment thread patterns/typestate.md Outdated
Comment thread patterns/typestate.md Outdated
Comment thread patterns/typestate.md
Comment thread SUMMARY.md Outdated
@simonsan

simonsan commented Jan 4, 2021

Copy link
Copy Markdown
Collaborator

@dgunay Hey, thank you for your contribution! Could you please rebase your branch on master please and link typestate.md in SUMMARY.md? We'll review this PR the upcoming days.

Hi, thank you @simonsan. I am currently unfamiliar with how to do rebases (have never done them yet). I see you merged master into patch-1 - do I still need to do anything?

No, I did it, so we let it check with the CI. I've made a small review, maybe you could address the suggestions questions in it for now? ;-) Thanks

@simonsan simonsan marked this pull request as draft January 4, 2021 07:43
@pickfire

pickfire commented Jan 6, 2021

Copy link
Copy Markdown
Contributor

Note that there are other method to have type state, like each one of the state as their own struct, which is more useful when different states have different types. If different states have different types but combined with this technique, there could easily be footguns.

@simonsan

simonsan commented Jan 6, 2021

Copy link
Copy Markdown
Collaborator

Note that there are other method to have type state, like each one of the state as their own struct, which is more useful when different states have different types. If different states have different types but combined with this technique, there could easily be footguns.

Do you want to make some suggestions to change. I see a bit of a problem in that this is taken from another author as well. And I struggle a bit to reach the author. He answered me that we could link to his article and I should get back if linking is not an option for relicensing. So I wrote back that just linking the article is probably not the best way, if we want to keep it in the repository. But didn't receive an answer yet. So citation of some stuff might be fine in this regards, but just taking a lot from the article is not, I feel. So we might have to rewrite it nevertheless. Unless the author shows up here and states what he thinks (what he could, as I sent him a link to this PR).

@pickfire

pickfire commented Jan 11, 2021

Copy link
Copy Markdown
Contributor

I mean something like using structs to have types as state. Like from Letter { data: ... } to ClosedLetter to OpenedLetter or something like that, I once read another article like this.

@simonsan simonsan added C-stale Category: An issue/a PR that hasn't been worked on in a longer time (usually 90 days) A-pattern Area: Content about Patterns and removed C-waiting for Category: Waiting for feedback of the initial author or some external dependency/issue labels Jan 21, 2021
@pickfire pickfire mentioned this pull request Feb 22, 2021
@simonsan

Copy link
Copy Markdown
Collaborator

@pickfire

Copy link
Copy Markdown
Contributor

I believe we can add something like #227 here and fix that along since it is similar enough? Here it encodes the state as variable but that encodes it as a type (which I think is more preferable).

@simonsan

Copy link
Copy Markdown
Collaborator

@simonsan

Copy link
Copy Markdown
Collaborator

Closing in favour of #249

@simonsan simonsan closed this Mar 28, 2021
@simonsan

simonsan commented Apr 2, 2021

Copy link
Copy Markdown
Collaborator

Reopening due to change of scope of #249

@simonsan simonsan reopened this Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-pattern Area: Content about Patterns C-addition Category: Adding new content, something that didn't exist in the repository before C-stale Category: An issue/a PR that hasn't been worked on in a longer time (usually 90 days)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants