From 525f59df61ca4f3ed868e312fa02f643ddda7d0c Mon Sep 17 00:00:00 2001 From: tvallotton <57121854+tvallotton@users.noreply.github.com> Date: Sat, 4 Mar 2023 16:40:50 -0300 Subject: [PATCH 1/2] Create postix-question-mark.md --- evaluation/syntax/postix-question-mark.md | 68 +++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 evaluation/syntax/postix-question-mark.md diff --git a/evaluation/syntax/postix-question-mark.md b/evaluation/syntax/postix-question-mark.md new file mode 100644 index 0000000..957b181 --- /dev/null +++ b/evaluation/syntax/postix-question-mark.md @@ -0,0 +1,68 @@ +- Name: `postix-question-mark` +- Proposed by: [@tvallotton](https://github.com/tvallotton) + +# Design + +## base (reference) + + + +```rust +/// A trimmed-down version of the `std::Iterator` trait. +pub trait async? Iterator { + type Item; + async? fn next(&mut self) -> Option; + fn size_hint(&self) -> (usize, Option); +} + +/// An adaptation of `Iterator::find` to a free-function +pub async? fn find(iter: &mut I, predicate: P) -> Option +where + I: async? Iterator + Sized, + P: FnMut(&T) -> bool; +``` + +## always async + + + +```rust +/// An adaptation of `Iterator::find` to a free-function +pub async fn find(iter: &mut I, predicate: P) -> Option +where + I: async Iterator + Sized, + P: FnMut(&T) -> bool; +``` + +## maybe async + + + +```rust +pub async? fn find(iter: &mut I, predicate: P) -> Option +where + I: async? Iterator + Sized, + P: FnMut(&T) -> bool; +``` + +## generic over all modifier keywords + + + +```rust +/// A trimmed-down version of the `std::Iterator` trait. +pub trait effect Iterator { + type Item; + effect fn next(&mut self) -> Option; + fn size_hint(&self) -> (usize, Option); +} +``` + +# Notes + +This is just a postfix version of the originally proposed syntax. +This should appear more familiar, as the question mark is normally used at the end of a +sentence, not at the beginning, and it looks similar to typescripts nullable types. +it also makes generic references more legible `&mut? T` vs `&?mut T`. From 4517ce954cba1eed6ada526557bc04bb34dbcc8c Mon Sep 17 00:00:00 2001 From: tvallotton Date: Sun, 5 Mar 2023 13:47:28 -0300 Subject: [PATCH 2/2] fix: spelling mistake --- .../{postix-question-mark.md => postfix-question-mark.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename evaluation/syntax/{postix-question-mark.md => postfix-question-mark.md} (98%) diff --git a/evaluation/syntax/postix-question-mark.md b/evaluation/syntax/postfix-question-mark.md similarity index 98% rename from evaluation/syntax/postix-question-mark.md rename to evaluation/syntax/postfix-question-mark.md index 957b181..040df3b 100644 --- a/evaluation/syntax/postix-question-mark.md +++ b/evaluation/syntax/postfix-question-mark.md @@ -1,4 +1,4 @@ -- Name: `postix-question-mark` +- Name: `postfix-question-mark` - Proposed by: [@tvallotton](https://github.com/tvallotton) # Design