Originally posted by TheBlackCat
View Post
Announcement
Collapse
No announcement yet.
Rust 1.17 Released
Collapse
X
-
Originally posted by davidbepo View Posti feel like rust could have been better, the threading and safety stuff is fine but the syntax is overly complex
In any case, I see no complexity issues with Rust syntax. The syntax is boiled down to:- :: means to access an item in a module / type
- . means to access a method on a variable
- <> is for explicitly defining type parameters
- => is for match arms
- -> defines the return type of a function
- .. is an exclusive range
- ... is an inclusive range
- 'name is for naming loops and lifetimes
- ? is syntax sugar for a match that returns on an error, else unwraps the Okd result
- & means to create an immutable reference
- &mut means to create a mutable reference
- * means to dereference a reference
- macro! is used to call a macro
- fn declares a function
- where clauses define type parameters for generic arguments in functions
Last edited by mmstick; 27 April 2017, 04:41 PM.
- Likes 5
Comment
-
Originally posted by TheBlackCat View Post
Which seems the opposite approach from how I would expect modern programming language development to proceed.
- Likes 2
Comment
-
Originally posted by mmstick View Post
You should contribute to the Ion shell that I have been working on. It is currently much faster than both Bash and Dash, with a cleaner syntax and support for first class arrays -- something other shells completely lack. I am continually looking for people to mentor into the project, as otherwise it's just me working on the project, and that's no good for such a big project to scale into the future. One of the areas needing work is implementing more shell commands as builtin commands.
https://chat.redox-os.org/redox/channels/ion
(also, in Fish, every variable is an array, so you might want to retract your array statement)Last edited by Vistaus; 28 April 2017, 04:55 AM.
Comment
-
Originally posted by andreano View Post
In fish, every variable is an array.
Comment
-
Fish treating all variables as arrays doesn't make arrays first class citizens in Fish. Ion treats strings and arrays as two completely separate entities. The @ and $ sigils differentiate between the two. They each have methods of their own as well, such as @split() and $join(). No ambiguity.Last edited by mmstick; 28 April 2017, 02:01 PM.
Comment
-
Rust is great. I love it!
And yes, shell languages are pretty terrible. The problem is that shells are used by people, who want the simple things to be very simple. But that, like using simple spaces to separate command arguments, means that spaces have to be escaped. And since people don't want complicated, explicit variable declarations in their shell, we have to handle weird things using $. Or @. Or %.
If you find yourself doing complicated things in shell just don't. Use literally ANY scripting language: it will be a better choice.
Comment
Comment