Skip to content

Tuples and Inline Tables: A Motivation #219

@wycats

Description

@wycats

This builds on #154, which would be very useful regardless of whether this proposal is accepted.

Hurray for tuples! @mojombo

Currently, there is no syntax for inline tables, which means that you're forced to create a new section for simple cases. In Cargo:

[dependencies.hammer]

version = "1.0.0"
git = "https://github.com/wycats/hammer.rs"

We have a shorthand for the case where a dependency only needs to specify a version:

[dependencies]

hammer = "1.0.0"

With tuples, we could do something like:

[dependencies]

hammer = ("1.0.0", "git", "https://github.com/wycats/hammer.rs")

I would like to propose a syntax for inline tables:

[dependencies]

hammer = ("1.0.0", git: "https://github.com/wycats/hammer.rs")
# or alternately
hammer = ("1.0.0", git = "https://github.com/wycats/hammer.rs")

I would be comfortable with restricting inline tables to the last element of a tuple, to eliminate the need for additional braces or something around the table.

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