3 ms·
What every other modern language makes this work? Dynamic languages? C++? Nope. Golang? Nope. Java? Nope. JS/Typescript? Nope. Like I said, if the feature is n
by ojosilva 3y ago
What every other modern language makes this work? Dynamic languages? C++? Nope. Golang? Nope. Java? Nope. JS/Typescript? Nope.
Like I said, if the feature is not compatible with the core principles of the language maybe they shouldn't be in it. Look for the issues in Github you'll see how and why the feature is not in the language. No excuses. All debatable, but arguments do make sense. And go make your case there!
You absolutely don't need to do manual name mangling. It sure does have things in common with how struct literals work, and in fact you can use them right now with some of the common patterns for named parameters in Rust:
foo( FooConfig::new().host("localhost").port(8080) );
enum Param {
Listen { host: String, port: u16 },
Pipe { file: String },
};
foo( Param::Listen { host: "locahost", port: 8080 } );
foo( Param::Pipe { file: "./pipe".to_string() } );
Not that bad really, makes it clear what combination of params you can send. And nicely compatible with `match` patterns later in foo()! I absolutely despise this about named parameters:
plot( y=100, z=300, x=200 ); --> the order of x,y,z makes it hard to read!
plot( 200, 100, 300); --> much better!
> You don’t have to use those features if you don’t want to.
Yeah, then we can have Rust bloated like C++, a untractable codebase and many ways to do it.