News for hackers. Stuff that matters.
Re:Curl is C by mundanevoice on Monday March 27, 2017 @10:16AM (#13967857)
I hope Rust doesn't face the same fate as other ambitious projects by Mozilla. Rust has a quite unusual syntax compare to any other systems programming language. Also, there is a big learning curve. Keeping all the benefits aside, I really hoped Rust had a simpler syntax. I really think, one day a language will borrow the good parts of Rust with a simpler syntax and get ahead of it. Rust in its current form will never be as successful as C/C++.
Re:Curl is C by naasking on Monday March 27, 2017 @12:03PM (#13968845)
> Rust has a quite unusual syntax compare to any other systems programming language.

In what way? It's very C-like in its basic syntactic structure, just more regular.

Re:Curl is C by mundanevoice on Tuesday March 28, 2017 @12:49AM (#13974164)
Well, I was not talking about basic syntactic structure. For eg: take a look at this https://github.com/servo/servo/blob/master/components/conste...

I am not against Rust. Rust has some great ideas and intent. I just feel they should have created simpler syntax. A more complex and unusual syntax doesn't have any real benefits IMO.

Re:Curl is C by naasking on Tuesday March 28, 2017 @12:00PM (#13977725)
You still haven't pointed out what syntax is problematic exactly. I've never programmed in Rust, but I don't have any trouble reading it coming from a C and C# background.

What exactly is the problem with the example you linked to?

Re:Curl is C by pcwalton on Tuesday March 28, 2017 @12:04PM (#13977760)
What's the issue with that example?
Re:Curl is C by naasking on Tuesday March 28, 2017 @12:50PM (#13978247)
Not having programmed in Rust, the fact that Rust requires all type parameters to be used, thus ruling out proper phantom types, was semantically surprising to me. But I don't understand what syntactic issue the other poster had with that example.
Re:Curl is C by steveklabnik on Tuesday March 28, 2017 @01:11PM (#13978429)
Re:Curl is C by naasking on Tuesday March 28, 2017 @01:46PM (#13978792)
Yes I get it, it just seems unnecessary to require every type parameter to be used. Do you have a link to the discussion motivating this choice?
Re:Curl is C by steveklabnik on Tuesday March 28, 2017 @02:17PM (#13979148)
In my understanding, it has to do with variance. This happened a very long time ago, before 1.0, and so I don't know where the discussion happened, off the top of my head.
Re:Curl is C by naasking on Tuesday March 28, 2017 @03:17PM (#13979724)
Found it: https://github.com/rust-lang/rfcs/blob/master/text/0738-vari...

It still seems bizarre to me that a purely type-level expression is forced by an effectively non-existent term. That RFC specifically states that the main problem is that the results of variance inference are largely erased by assuming invariance. That seems like a sensible default for unused type parameters too.

It seems from the conclusion of that post that PhantomData only survived because this was the smallest change they had to make to get this all to work better, and because some of this PhantomData could be used for other analyses in the compiler (although it's not clear if better type information could have replaced these uses anyway).

Re:Curl is C by pcwalton on Monday March 27, 2017 @12:06PM (#13968869)
Can you elaborate as to the specific syntax problems you see with Rust?
Re:Curl is C by mundanevoice on Tuesday March 28, 2017 @12:52AM (#13974179)
This is from servo codebase - https://github.com/servo/servo/blob/master/components/domobj...

Take a look at this. It isn't as simple and clear as C/C++ for example and requires significant investment in parsing and understanding the code.

Re:Curl is C by mkawia on Tuesday March 28, 2017 @02:45PM (#13979431)
That's quote ,a library that generates code for you at compile time ,it takes code as input,has it's own syntax. It's like compile-time reflection.

It's not code rust programmers would normally write, I'm one of those programmers. I'm glad some libraries like serde,rocket and diesel are using it to generate code instead of doing run-time analysis.

Re:Curl is C by pcwalton on Tuesday March 28, 2017 @12:02PM (#13977740)
You quoted a macro definition. The equivalent in C++ would be heavy preprocessor use, which is usually much worse.
Re:Curl is C by sullyj3 on Monday March 27, 2017 @11:37PM (#13973840)
The type and lifetime annotations can get pretty confusing.
Re:Curl is C by pcwalton on Tuesday March 28, 2017 @12:03PM (#13977746)
Do you have a specific proposal as to what lifetime syntax should be changed to?