Skip to content

Rename "task" to "future" in futures API #1087

Closed
@MajorBreakfast

Description

@MajorBreakfast

This week I explored the code of the futures 0.1's task system. I realized that in futures 0.1 a task was this thing:

pub struct Task {
    id: usize,
    unpark: TaskUnpark,
    events: UnparkEvents,
}

In 0.3 the most similar thing to this is the context. In 0.1 there was of course always a future associated with each task. There's so much existing meaning attached to what a task is. It should be seriously considered whether we want to continue using the term "task" in 0.3. In 0.3, basically what we call a "task" is just a static future with output () that is spawned. We could use the term "task" for it, but should we?

Specifically I'd like to change these occurrences from "task" to "future":

https://github.com/rust-lang/rust/blob/ccade97544d34f42c37fc27fe8c7edba05d3eddb/src/libcore/task/executor.rs#L32

https://github.com/rust-lang/rust/blob/ccade97544d34f42c37fc27fe8c7edba05d3eddb/src/libcore/task/executor.rs#L79

Edit: Heh... and the core::task module is of course also called "task". It was decided to make it an extra module because it is planned that it should contain shared code between stream and future. And "A task is a ()-producing async value", i.e. a future. Considering this, the name seems not so suitable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions