What you are saying makes no sense. Either you have fewer, but more complex instructions or you have more, but simpler instructions. You can't have both.
They aren't instructions, he is specifically talking about assembly macros.
If you don't know what something is, don't pretend to follow along.Many assemblers support predefined macros, and others support programmer-defined (and repeatedly re-definable) macros involving sequences of text lines in which variables and constants are embedded. This sequence of text lines may include opcodes or directives. Once a macro has been defined its name may be used in place of a mnemonic. When the assembler processes such a statement, it replaces the statement with the text lines associated with that macro, then processes them as if they existed in the source code file (including, in some assemblers, expansion of any macros existing in the replacement text).
Note that this definition of "macro" is slightly different from the use of the term in other contexts, like the C programming language. C macros created through the #define directive typically are just one line, or a few lines at most. Assembler macro instructions can be lengthy "programs" by themselves, executed by interpretation by the assembler during assembly.
Since macros can have 'short' names but expand to several or indeed many lines of code, they can be used to make assembly language programs appear to be far shorter, requiring fewer lines of source code, as with higher level languages. They can also be used to add higher levels of structure to assembly programs, optionally introduce embedded debugging code via parameters and other similar features.
Link to the Wiki org page Rust (programming language) - Wikipedia, the free encyclopedia
Tim S.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
So, I'm currently looking through the Rust wiki and I have some comments/thoughts :
1. No null pointers is interesting to me though I'm sure other languages already have this
2. It's performance is expected to be similar to C++ with proper checking which means native versions of C++ are faster and a performant build of Rust would have to be "unsafe"
3. I like the functional style in the factorial examples and that if-else is an 'expression'
4. Things are automatically immutable so I don't see how time is saved or this is preferred over using 'const' in C/C++ because I have to declare 'mut' for everything I want changed
5. println() is no better than printf() and both are less useful in my mind than std::cout which just prints anything without me specifying
6. Spawning multiple threads is very similar to std::thread + lambdas
And I have to read more about the pattern matching and recursive data structure examples to understand them.
Yeah, once I discovered languages that don't have null I pretty much stopped being impressed by languages that didn't solve this problem. That's why I didn't like Dart: it's not doing enough to really replace JavaScript. It has all the null pointers, all the callback hell, it's just a small improvement that's not worth the investment to learn it.
Unlike D, Rust doesn't have "unsafe" builds that perform better. But you can write code that is marked trusted and the compiler assumes you know what you're doing. In other words, you either leave safety to yourself or the compiler. You'll have to use the more low level APIs explicitly.
In regards to const, 80% of all variables are used once and only once. What's the point of marking 80% of your variables const when you can just mark 15% of your variables mut? (The other 5% are never used)
println! macro is better than printf because it won't compile when you have the wrong amount of arguments, while printf will barf at runtime
Not to make a mountain out of a molehill, but:
I think rust is just different in terms of const. I have heard that every variable is constant until proven otherwise, but in C/C++, most variables are not const because they must have a useful, immutable value when they are defined. Most programs transform input in some way. Why would I want to declare all of my variables with human input or otherwise mut when they most likely always need to be modified at least once? Most of the examples do not show why this design choice is helping anybody.
if you are compiling such that printf() is not being checked, then you are doing it wrong. You aren't supposed to compile with warnings turned off. That is basic stuff.
Last edited by whiteflags; 06-23-2014 at 03:18 AM.
to the contrary, most variables are something like
and then laterCode:ui_inputSpinBox1 = findChild<QSpinBox*>("inputSpinBox1");
so you assign something, use it once and you're doneCode:ui_outputWidget->setText(QString::number(value + ui_inputSpinBox2->value()));
this is 80% of all variables according to research
Well, I'm not 80% of all researchers.
In my coding, there isn't a variable that I don't mutate at one point in time. Or at least, the ratio is severely different. I do have consts but very few of them.
Okay, I'm not saying Rust is bad. The threading model in Rust is absolutely sublime but that's only because I already think C++11's threading model is sublime and Rust's is incredibly similar.
But I'm a scientific programmer. How can Rust help me? Is Rust the language I should use? These aren't meant to be hostile questions. I am literally asking, is Rust good for scientific applications? This thread has shown me that it seems best for security-intensive applications but everything I write, I want people to see everything. I also need performance above all else.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
It's also not the goal according to the developers of the language. The goal is to have a language with the same performance of C++ and better safety than Java while still not having GC. For example, it statically guarantees you have no data races, while Go only detects them heuristically. If anything, web stuff is still half-baked in Rust.
"...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson
Of course not, but it doesn't have a standard HTTP library yet, just some attempts by community members.
On another note, Rust compiler is pretty smart:
it actually realizes that this is a valid programCode:fn main() { let compiler_knows_this_is_initialized; let mut x = 1u8; loop { if x > std::rand::random() { compiler_knows_this_is_initialized = x; break; } x += 1; } println!("{:u}", compiler_knows_this_is_initialized); }
Whoa, I'm tripping out. Either I don't know enough about const-ness or you're mutating an immutable variable...
Or can read-only variables be initialized with a value once and only once? Or does the initialization have to happen at declaration? I always thought it was at declaration.