Hacker News new | past | comments | ask | show | jobs | submit login

1. You don’t have to use those features if you don’t want to.

2. Every other modern language makes this work, only rust makes excuses.

3. Rust already has default generic type arguments and “named parameters” for struct constructors (which in fact are mandatory), for which the same criticisms also apply to.

Rust is already tedious enough to work with as is, and the last thing it needs is more builder pattern or manual name mangling. You already need mut/non mut for getters, sync/async, etc. just look at [serde](https://docs.rs/serde/latest/serde/trait.Deserializer.html) or polars or ndarray. Ugliest language ever.




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.


You don’t have to use the language if you don’t like it or if you don’t agree with its design decisions. It sounds like you don’t like anything about the language, so adding named parameters won’t win you over.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: