Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ellipses elision in patterns instead of double-dot.
  • Start Date: (fill me in with today's date, YYYY-MM-DD)
  • RFC PR: (leave this empty)
  • Rust Issue: (leave this empty)

Summary

Use ellipses ... instead of the current double dot notation .. for elision in patterns, such as in match expressions.

example:

// `...` is new here, used to be `..`
match foo {
    Foo(...) => { ... },
	Bar(...) => { ... }, //even in examples '...' are used to 'elide' the content.
}

Motivation

With range notation becoming a more important aspect of the language, using the same syntax for elision in patterns and ranges may be confusing. Also, the ellipses in English is used for omission, which is the intended purpose in the language. This will make it more clear what it truly is.

Detailed design

Replace .. in patterns with ..., unless the .. is for a range.

Drawbacks

  • Seemingly unnecessary change, may be a burden to implement

  • This may conflict with the inclusive range notation proposals.

Alternatives

None.

Unresolved questions

Will implementing this lead to an amiguity in current uses of the ellipses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment