Python Forum
alternative to python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
alternative to python
#31
(Nov-06-2016, 06:55 PM)micseydel Wrote: I've heard that Rust is largely replacing C. Assembly I think is useful for learning more about hardware, which is great, but shouldn't be misunderstood as (generally) useful. JS is a necessary evil right now  :(

So I've been reading the Rust Book (https://doc.rust-lang.org/book/), and Rust is a crazy impressive language.  Everything is immutable by default, and objects have a sense of 'ownership' and scope, which the compiler enforces, which makes cleanup easy.  What I like is the way error handling is done... a given function can only raise a single type of error, if you want to return more than one, you need to create a new error type to represent it.  If a function CAN return an exception, the compiler FORCES you to handle it (even if handling it is just re-raising it).

And almost everything is an expression.  It almost feels like ruby, in that the last line of a function is that function's return value, even if you don't explicitly use the keyword "return".  And almost everything returns a value... like match (their switch/case), or if.  So you can do things like...
// this is a complete program
// writes "The value: foobar" to console

fn main() {
    let spam = "eggs";
    let some_value = match spam {
        "12" => "twelve",
        "eggs" => "foobar",
        _ => "default value"
    };

    println!("The value: {}", some_value);
}
Reply


Messages In This Thread
alternative to python - by Skaperen - Oct-23-2016, 09:05 AM
RE: alternative to python - by ichabod801 - Oct-23-2016, 12:57 PM
RE: alternative to python - by snippsat - Oct-23-2016, 02:28 PM
RE: alternative to python - by Larz60+ - Oct-23-2016, 04:02 PM
RE: alternative to python - by ichabod801 - Oct-23-2016, 08:08 PM
RE: alternative to python - by Skaperen - Oct-24-2016, 03:12 AM
RE: alternative to python - by Larz60+ - Oct-24-2016, 03:25 AM
RE: alternative to python - by j.crater - Oct-24-2016, 05:29 AM
RE: alternative to python - by Larz60+ - Oct-24-2016, 10:44 AM
RE: alternative to python - by sparkz_alot - Oct-24-2016, 01:50 PM
RE: alternative to python - by Larz60+ - Oct-24-2016, 02:51 PM
RE: alternative to python - by nilamo - Oct-24-2016, 03:51 PM
RE: alternative to python - by micseydel - Oct-24-2016, 04:02 PM
RE: alternative to python - by nilamo - Oct-24-2016, 04:05 PM
RE: alternative to python - by Larz60+ - Oct-24-2016, 05:12 PM
RE: alternative to python - by micseydel - Oct-24-2016, 05:42 PM
RE: alternative to python - by Root13 - Nov-04-2016, 09:41 AM
RE: alternative to python - by Skaperen - Nov-06-2016, 05:03 AM
RE: alternative to python - by Larz60+ - Nov-06-2016, 05:37 AM
RE: alternative to python - by Skaperen - Nov-07-2016, 10:06 AM
RE: alternative to python - by wavic - Nov-06-2016, 08:17 AM
RE: alternative to python - by Larz60+ - Nov-06-2016, 12:06 PM
RE: alternative to python - by ichabod801 - Nov-06-2016, 03:05 PM
RE: alternative to python - by micseydel - Nov-06-2016, 06:55 PM
RE: alternative to python - by nilamo - Dec-06-2016, 03:46 PM
RE: alternative to python - by ichabod801 - Nov-06-2016, 09:50 PM
RE: alternative to python - by micseydel - Nov-06-2016, 10:42 PM
RE: alternative to python - by nilamo - Nov-07-2016, 04:04 PM
RE: alternative to python - by wavic - Nov-06-2016, 11:01 PM
RE: alternative to python - by Larz60+ - Nov-07-2016, 01:25 AM
RE: alternative to python - by Larz60+ - Nov-07-2016, 12:41 PM
RE: alternative to python - by micseydel - Dec-06-2016, 03:50 PM
RE: alternative to python - by nilamo - Dec-06-2016, 03:54 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020