Skip to content

Check in designs #16

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

Merged
merged 2 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions evaluation/syntax/_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
- Name: (fill me in: `name-of-design`)
- Proposed by: [@name](link to github profile)
- Original proposal (optional): (url)

# Design

<!-- Please fill out the snippets labeled with "fill me in". If there are any
other examples you want to show, please feel free to append more.-->

## base (reference)

<!-- This is the snippet which is being translated to various scenarios we're
translating from. Please keep this as-is, so we can reference it later.-->

```rust
/// A trimmed-down version of the `std::Iterator` trait.
pub trait Iterator {
type Item;
fn next(&mut self) -> Option<Self::Item>;
fn size_hint(&self) -> (usize, Option<usize>);
}

/// An adaptation of `Iterator::find` to a free-function
pub fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T>
where
I: Iterator<Item = T> + Sized,
P: FnMut(&T) -> bool;
```

## always async

<!-- A variant where all items are always `async` -->

```rust
// fill me in
```

## maybe async

<!-- A variant where all items are generic over `async` -->

```rust
// fill me in
```

## generic over all modifier keywords

<!-- A variant where all items are generic over all modifier keywords (e.g.
`async`, `const`, `gen`, etc.) -->

```rust
// fill me in
```

# Notes

<!-- Add additional notes, context, and thoughts you want to share about your design
here -->
90 changes: 90 additions & 0 deletions evaluation/syntax/progress-report-feb-2023.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
- Name: `progress-report-feb-2023`
- Proposed by: [@yoshuawuyts](https://github.com/yoshuawuyts) and [@oli-obk](https://github.com/oli-obk)
- Original proposal: [Keyword Generics Progress Report: February 2023 | Inside Rust Blog](https://blog.rust-lang.org/inside-rust/2023/02/23/keyword-generics-progress-report-feb-2023.html)

# Design

<!-- Please fill out the snippets labeled with "fill me in". If there are any
other examples you want to show, please feel free to append more.-->

## base (reference)

<!-- This is the snippet which is being translated to various scenarios we're
translating from. Please keep this as-is, so we can reference it later.-->

```rust
/// A trimmed-down version of the `std::Iterator` trait.
pub trait Iterator {
type Item;
fn next(&mut self) -> Option<Self::Item>;
fn size_hint(&self) -> (usize, Option<usize>);
}

/// An adaptation of `Iterator::find` to a free-function
pub fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T>
where
I: Iterator<Item = T> + Sized,
P: FnMut(&T) -> bool;
```

## always async

<!-- A variant where all items are always `async` -->

```rust
pub trait async Iterator {
type Item;
async fn next(&mut self) -> Option<Self::Item>;
fn size_hint(&self) -> (usize, Option<usize>);
}

pub async fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T>
where
I: async Iterator<Item = T> + Sized,
P: async FnMut(&T) -> bool;
```

## maybe async

<!-- A variant where all items are generic over `async` -->

```rust
pub trait ?async Iterator {
type Item;
?async fn next(&mut self) -> Option<Self::Item>;
fn size_hint(&self) -> (usize, Option<usize>);
}

pub ?async fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T>
where
I: ?async Iterator<Item = T> + Sized,
P: ?async FnMut(&T) -> bool;
```

## generic over all modifier keywords

<!-- A variant where all items are generic over all modifier keywords (e.g.
`async`, `const`, `gen`, etc.) -->

*A slight modification from the report, using `effect` instead of `?effect`.*

```rust
pub trait effect Iterator {
type Item;
effect fn next(&mut self) -> Option<Self::Item>;
fn size_hint(&self) -> (usize, Option<usize>);
}

pub effect fn find<I, T, P>(iter: &mut I, predicate: P) -> Option<T>
where
I: effect Iterator<Item = T> + Sized,
P: effect FnMut(&T) -> bool;
```

# Notes

This is the original design proposed by the Keyword Generics Initiatve in the
Feb 2023 Progress Report.

<!-- Add additional notes, context, and thoughts you want to share about your design
here -->