I would be interested using Rust if it weren't for the poorly chosen language syntax. Same goes for Kotlin and Swift. Coming from C/C++ background I don't care for declaring variable names before their types. val/let, fn (instead of say "func" or "function"), etc... I hate implicit types and operations instead of being explicit.
I don't use Rust but I've done a lot of Swift, and have a very long history using C/C++ in the past...
I don't care for declaring variable names before their types
For me, I ended up not really caring which side of variable a type is declared on. I do like being able to omit the type in every expression, then I can choose if its clearer to add it, or the simplicity of leaving it out is clearer.
val/let
I agree here, to me that is just noise - you are basically telling the compiler if you expect to modify something going forward.
Although I see the benefit, it just seems really annoying the programmers would have to give the compilers clues like this. I can see real value in declaring something inline, sure, an explicit helping flag you use one in a while. But val/let (or in Swift, var/let) you have to use for every single declaration, and if you use the "wrong" one you'll get a warning or an error you have to go back and correct.
I suppose I wouldn't even mind having to constantly tell the compiler something it should be able to easily figure out in most cases... except that it's not consistent. In Swift if you are dealing with classes instead of structs, Swift is perfectly happy (and indeed demands through warnings) the use of let (immutable) declaration for a variable, that you then happily go an alter properties of or call methods on that mutate the object...
It just buys you so little and is so much clerical work, I could do without that and be very happy probably at the expense of some performance - but you could give that back by annotating key areas as if they would have been let if I choose.
fn (instead of say "func" or "function")
In swift it's func which I agree I like a little more, but not enough to really care here either.
I hate implicit types and operations instead of being explicit.
Now here I strongly disagree, I love the clarity and simplicity implicit types can bring. Remember the the implicit stuff is always a choice (at least it is in Swift, I can't speak to Rust), you can still write that first example with a return statement. In Swift that first method would be written as:
func plus_one(x: Int) -> Int {
return x + 1; }
I don't really see it as being any less desirable than the C form.
It's the syntax (Score:5, Insightful)
I would be interested using Rust if it weren't for the poorly chosen language syntax. Same goes for Kotlin and Swift. Coming from C/C++ background I don't care for declaring variable names before their types. val/let, fn (instead of say "func" or "function"), etc... I hate implicit types and operations instead of being explicit.
fn plus_one(x: i32) -> i32 {
x + 1;
}
Ugly as hell compared to
int plus_one(int x) {
return x + 1;
}
it's also far more explicit
Mixed feelings on those. (Score:2)
I don't use Rust but I've done a lot of Swift, and have a very long history using C/C++ in the past...
I don't care for declaring variable names before their types
For me, I ended up not really caring which side of variable a type is declared on. I do like being able to omit the type in every expression, then I can choose if its clearer to add it, or the simplicity of leaving it out is clearer.
val/let
I agree here, to me that is just noise - you are basically telling the compiler if you expect to modify something going forward.
Although I see the benefit, it just seems really annoying the programmers would have to give the compilers clues like this. I can see real value in declaring something inline, sure, an explicit helping flag you use one in a while. But val/let (or in Swift, var/let) you have to use for every single declaration, and if you use the "wrong" one you'll get a warning or an error you have to go back and correct.
I suppose I wouldn't even mind having to constantly tell the compiler something it should be able to easily figure out in most cases... except that it's not consistent. In Swift if you are dealing with classes instead of structs, Swift is perfectly happy (and indeed demands through warnings) the use of let (immutable) declaration for a variable, that you then happily go an alter properties of or call methods on that mutate the object...
It just buys you so little and is so much clerical work, I could do without that and be very happy probably at the expense of some performance - but you could give that back by annotating key areas as if they would have been let if I choose.
fn (instead of say "func" or "function")
In swift it's func which I agree I like a little more, but not enough to really care here either.
I hate implicit types and operations instead of being explicit.
Now here I strongly disagree, I love the clarity and simplicity implicit types can bring. Remember the the implicit stuff is always a choice (at least it is in Swift, I can't speak to Rust), you can still write that first example with a return statement. In Swift that first method would be written as:
func plus_one(x: Int) -> Int {
return x + 1;
}
I don't really see it as being any less desirable than the C form.