3 ms·
Our original formatting was inspired by C#, this is inspired by Python. We stand on the shoulders of giants, as always.
by steveklabnik 6y ago
Our original formatting was inspired by C#, this is inspired by Python. We stand on the shoulders of giants, as always.
- Macha 6y agoDidn't realise the C# intermediate step was there, always assumed it was a direct Python influence.
- steveklabnik 6y agoOh you know, I was confused. It was attributes from C#, not format strings. https://doc.rust-lang.org/stable/reference/attributes.html#attributes https://doc.rust-lang.org/stable/reference/attributes.html#a... > Attributes are modeled on Attributes in ECMA-335, with the syntax coming from ECMA-334 (C#).
- kibwen 6y agoI believe Rust took both attributes and format strings from C#. It looks like Python's modern format string syntax dates to 2006, and I think(?) that C#'s format string syntax has been present since its first release in 2002. The PEP adding the modern string formatting syntax links to .NET documentation, although the link is now dead: https://www.python.org/dev/peps/pep-3101/#references https://www.python.org/dev/peps/pep-3101/#references
- maxioatic 6y agoIf you don't mind me asking - what goes into implementing a feature like this in Rust? Asking as a complete noob in language design/implementation.
- nindalf 6y agoYou want to take a look at the RFC process. You could start with the feature we're discussing right now - Implicit arguments in format strings (https://rust-lang.github.io/rfcs/2795-format-args-implicit-identifiers.html https://rust-lang.github.io/rfcs/2795-format-args-implicit-i...). Take a look, it's very readable. There's discussion in the corresponding Github issue of the RFCs repo (https://github.com/rust-lang/rfcs https://github.com/rust-lang/rfcs). If the folks who work in that area are supportive, the RFC will be merged. After that someone needs to implement the feature. Take a look at the Readme in the RFCs repo for more details.
- maxioatic 6y agoThanks for the info, appreciate it!
- k__ 6y agoI'm pretty excited about more implicit stuff coming to Rust. The array/iterator thing always baffled me when I first started learning Rust. All these tiny DX improvements make the language more accessible and in turn a pleasure to work with!
- steveklabnik 6y agoIn general, nindalf's reply is very on point about the mechanics. To expand ever so slightly on this bit: > If the folks who work in that area are supportive Rust has teams that make decisions to accept designs in their part of the project. They look at proposals and decide to accept, reject, or postpone them. This process can take a while, depending on all sorts of factors. Sometimes a design may be good, but it may not be the time yet, which is when postponing happens. Sometimes it's a "we don't plan on doing this" and that's when things get rejected. Even if a design is accepted, we don't require that people proposing the design do the implementation work, so if you do propose something and it does get accepted, it may take a while until it actually exists. Furthermore, stuff is in unstable at first, until people can gain experience with the feature, so even after an RFC is accepted, it takes some time until it's "stabilized," at which point it's part of the language proper. Happy to answer any other specific questions!