1. 12
  1. 3

    A programming language is low level when its programs require attention to the irrelevant. – Alan Perlis

    Still the best definition of the term ever. Rust works perfectly well for high-level tasks, and in many ways is better (IMO) at them than traditional scripting languages. But, occasionally, Rust forces you to pay attention to the irrelevant:

    • Do I care about signed/unsigned numbers of particular sizes verses “it’s an integer, I guess”?
    • Do I care whether a String is copied or not when stuffing it into a hash table, and exactly how its mutation/allocation is controlled?
    • Do I care about the differences between String and OsString and the cost of copying stuff back and forth between them?
    • Do I care about setting up a full Cargo project with build and deploy steps?

    Lots of times the answers are definitely “yes”. And lots of times the answers are definitely “no, not really”. I think the time is ripe for a new generation of scripting languages. …or we could just use Scheme everywhere.

    1. 2

      Do I care about signed/unsigned numbers of particular sizes verses “it’s an integer, I guess”?

      Signed/unsigned is rather important, as it corresponds to the distinction between integers and naturals in mathematics.

      The “size” is mostly irrelevant though. When you step away from the computer, the phrase “size of a number” sounds rather nonsensical. So any language that doesn’t do arbitrary-precision arithmetic by default is low-level in this regard — and that’s basically almost every mainstream language (except Python and Ruby). I rather like R6RS in this regard.

      But I think that Rust, with its focus on performance, should stick to register-sized integer types by default.

      Do I care about the differences between String and OsString and the cost of copying stuff back and forth between them?

      If you don’t care about the cost of copying, then just copy and don’t worry. :) These types exist not to tell you about copying, but to tell you that these things are not the same. The only low-level thing about it is the mere existence of operating systems and OsString (their ideas of strings) which is often a necessity, if you want to write a program that will deal with all sorts of inputs on different platforms correctly.

    2. 1

      How to get the value of an environment variable in rust?

      1. 1

        std::env::var

        https://doc.rust-lang.org/std/env/fn.var.html

        Or did I misunderstand the question? Not high-level enough? ;)