• AldinTheMage@ttrpg.network
    link
    fedilink
    arrow-up
    1
    ·
    7 minutes ago

    That’s why we use JavaScript on the front end, JavaScript on the back end, and you can streamline it even more by using JavaScript for the db layer too. After all, if you have too much data to be reasonably parsed in a single .json file, you are probably just architecting wrong.

  • Jankatarch@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    1 hour ago

    Ngl changing paradigms can have the problems do a 180.

    I hate leetcode but it’s surprisingly fun to code certain questions in prolog when fnal outcome with error checking is like 15 lines.

  • Johanno@feddit.org
    link
    fedilink
    arrow-up
    19
    arrow-down
    1
    ·
    8 hours ago

    The language is as important as architecture and stuff.

    Pick the right language for the right task.

    Performance? Don’t use python.

    Everything else? Use python because everyone does.

    /s

  • MonkderVierte@lemmy.zip
    link
    fedilink
    arrow-up
    20
    ·
    edit-2
    9 hours ago

    The programming language promotes a thinking model and the ecosystem defines a modus operandi.
    Of course they matter.

  • AnarchoSnowPlow@midwest.social
    link
    fedilink
    arrow-up
    97
    arrow-down
    1
    ·
    19 hours ago

    Programming languages, much like the jackass in the middle, are tools. Different tools are for different things. The right tool for the job can make your day. The wrong tool can make you question your entire career.

    • Captain Aggravated@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      7
      ·
      11 hours ago

      I seem to remember hearing this story: Back in the 2000s, Google did all their back-end stuff in C++ to make sure it was performant, and when they acquired Youtube they found it was made in Python, slow to run, fast to develop.

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        7 hours ago

        Did they change it after the acquisition? Or is python why it’s still so freaking slow?

        • boonhet@sopuli.xyz
          link
          fedilink
          arrow-up
          6
          ·
          4 hours ago

          Lol @ YouTube being slow

          Look at the amount of data that goes through their servers every millisecond. It’s ridiculous. All things considered, YouTube is lightning fast.

          Maybe the UI isn’t as snappy as it could be, but the blame there lies solely on throwing more and more javascript at it to add “features” that end users don’t really want.

          • Victor@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            2 hours ago

            Aaand artificially slowing down video loading by several seconds, last but not least.

      • MotoAsh@piefed.social
        link
        fedilink
        English
        arrow-up
        10
        ·
        12 hours ago

        A tool of a person is a fool who is being used by someone else. They might not be useful to you, but to who ever makes the koolaid they’re drinking, they’re a very good tool.

        • CanadaPlus@lemmy.sdf.org
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          1 hour ago

          I think that’s the basic idea, but in practice it’s used for people who are just generally dumb as well.

      • DacoTaco@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        10 hours ago

        Tools are always useful. If its a good thing to (ab)use said tool depends on the tool and if its human or not :p
        … And the job for the tool ofc

    • staircase@programming.dev
      link
      fedilink
      arrow-up
      11
      ·
      edit-2
      18 hours ago

      Sometimes I just want to use a particular tool, and care less what I’m making with it.

      I rarely get this pleasure at work.

    • tomenzgg@midwest.social
      link
      fedilink
      English
      arrow-up
      2
      ·
      5 hours ago

      Not to stereotype too much but I think this is the first Blåhaj I’ve seen (in a programming context) that wasn’t team Rust.

      What your programming language of choice (if you don’t mind sharing)?

    • BehindTheBarrier@programming.dev
      link
      fedilink
      arrow-up
      16
      ·
      10 hours ago

      I can actually see where this is coming from, as I found Rust hard to read when I started out. I do really like Rust for reference, but I do agree Rust is hard to read for someone that has not learned it.

      For example:

      return statements that are implicit just because the semicolon isn’t there. Even better if they occur inside a if block or something like that. Very hard to understanding when you don’t know the syntax rules.

      Lambda functions, especially when using move semantics too. They are quite simple, but if you don’t know the meaning, it’s more arcane characters. Especially when this is used inside lots of chained methods, and maybe a multi-line function in the lambda.

      A lot for the if let x =… type of stataments are tough the first time around. Same for match statements.

      Defining types for use with function::<Type>() and such.

      Lifetimes, especially when they are all named a, b, c etc. It quickly gets messy, especially when combined with generics or explicitly defined types.

      Macros, though not entry level rust to begin with, they are really cumbersome to decode.

      None of these are sins of Rust, but for new people they are a hill to climb, and often hard to just “get” based on previous programming experience and reading the code. Rust can be really hard to approach because of these things. This happens in other languages too, but I do feel Rust has a particularly large amount of new concepts or ways to do something. And this is on top of learning lifetimes and borrow semantics.

      • 5C5C5C@programming.dev
        link
        fedilink
        arrow-up
        10
        ·
        9 hours ago

        This is the most sober take in this thread. I was bothered by all these things you mentioned for the first two weeks of using the language. I begrudgingly accepted them for the following two months because I felt the benefits of the language were worth it. Now all of these things feel natural and I don’t give them a second thought.

      • wewbull@feddit.uk
        link
        fedilink
        English
        arrow-up
        4
        arrow-down
        2
        ·
        7 hours ago

        I think that’s a great set of criticisms.

        None of these are sins of Rust, …

        They might not be strictly language issues, but if they are symptomatic of idiomatic rust then they are “sins of rust”. Something about the language promotes writing it using these kinds of idioms.

        Just like French speakers don’t pronounce 80% of the written syllables because it’s impractical to speak fast with all of them…language features (or lack of them) drive how the language is used.

        (BTW the implicit return behaviour on a missing semicolon sounds like Chekhov’s footgun)

        • 5C5C5C@programming.dev
          link
          fedilink
          arrow-up
          5
          ·
          6 hours ago

          Something about the language promotes writing it using these kinds of idioms.

          As someone who has used Rust professionally for 3 years, the idioms are good. I wouldn’t want the idioms to go away, and I don’t particularly want the style/aesthetics of the language to change unless it can be done without negatively affecting the idioms.

          It’s not a situation where the aesthetics are actually bad, it’s just different than what most programmers are used to, but almost all of the differences are for pretty good reasons. With enough familiarity and practice you’ll start to recognize those differences as benefits of the language rather than detriments.

          But I think a lot of people have so much inertia about tweaking their way of thinking that they don’t feel motivated to try long enough to make it over that hump, especially when their expectations get set by rabid Rust promoters like myself who insist that Rust is vastly superior to any other languages in almost all situations. The stark contrast between how good they’re told the language is and how they feel when first exposed to it might be too much whiplash for some people.

        • BehindTheBarrier@programming.dev
          link
          fedilink
          arrow-up
          3
          ·
          6 hours ago

          The implicit return is perhaps the most dubious of them. I don’t mind it for simple functions, but they are not so good in anything large and with multiple return sites. Even more so when developers choose to implicitly return 4 chained method calls inside a closure with else cases.

          But the rest aren’t really sins, they are mostly new or different concepts or ways to do something. And if there is a sin, it’s largely because the language itself has a complexity larger than others.

          Taking my own examples here, lambdas are just fine, but the move semantics are cumbersome to deal with. But we need to do it some way, to indicate that a value is actually being moved into the closure. Maybe there are better ways and they make into the language in the future.

          Conditional values and let statements and such is a good consequence of Rusts design choice with returning Results or Option types. Just because it’s different doesn’t make it a sin. Just takes time to learn the right way. I think most come from an exception based language, and that has a differnet code flow than what Rust has.

          Lifetimes are hard though, and I feel a lot of the introduction is made excessively hard with the simple naming. It’s as of every programming tutorial used single letter variable names. Lifetimes isn’t something I’m that good with either, mostly because I haven’t had to use that complexity yet.

    • LiveLM@lemmy.zip
      link
      fedilink
      English
      arrow-up
      12
      arrow-down
      1
      ·
      11 hours ago

      Go look at that Lisp kojumbo then tell me Rust is ugly.

      (defmethod wake ((object magic-packet) address port)
        (let* ((payload (encode-payload object))
               (size (length payload))
               (socket (usocket:socket-connect nil nil :protocol :datagram :element-type '(unsigned-byte 8))))
          (setf (usocket:socket-option socket :broadcast) t)
          (usocket:socket-send socket payload size :host address :port port)
          (usocket:socket-close socket)))
      

      Actually unreadable.

      • Zak@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        7 hours ago

        Entirely readable to someone who knows Common Lisp, and unreadable to someone who doesn’t know any kind of Lisp. Mostly readable to someone who knows Emacs Lisp, Clojure, or Scheme.

        Being able to correctly guess what the syntax does without knowing the language is a function of similarity to familiar languages more often than it is a characteristic of the syntax itself.

      • bigfondue@lemmy.world
        link
        fedilink
        arrow-up
        8
        ·
        edit-2
        10 hours ago

        Maybe Emacs has fried my brain, but that is perfectly readable. Common Lisp has one of the most advanced object systems around, so yea you can write hard to read stuff if you want

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        7 hours ago

        It’s like comparing Hitler to Stalin. Both are pretty shit… Two things can be ugly at the same time. 😅

    • Ethan@programming.dev
      link
      fedilink
      English
      arrow-up
      36
      ·
      19 hours ago

      Almost any language is ok but some ecosystems make me want to turn into a murder hobo (looking at you, JavaScript).

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        16
        arrow-down
        15
        ·
        13 hours ago

        Average Rust code:

        macro_rules! sum {
            ( $initial:expr $(, $expr:expr )* $(,)? ) => {
                $initial $(+ $expr)*
            }
        }
        
        fn remove_prefix<'a>(mut original: &'a str, prefix: &str) -> &'a str
        
        let mut up = 1;
            'outer: loop {
        

        Hell I don’t want to know what you define as ugly then.

          • wewbull@feddit.uk
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            3
            ·
            8 hours ago

            What language are they then? They’re not Python, JS, <insert any other language here>

            • calcopiritus@lemmy.world
              link
              fedilink
              arrow-up
              3
              ·
              2 hours ago

              You used macro_rules, which is not common at all. Most rust files don’t contain any macro definition.

              This code doesn’t even compile. There is a random function definition, and then there are loose statements not inside any code block.

              The loop is also annotated, which is not common at all, and when loops are annotated it’s a blessing for readability. Additionally, the loop (+annotation) is indented for some reason.

              And the loop doesn’t contain any codeblock. Just an opening bracket.

              Also, the function definition contains a lifetime annotation. While they are not uncommon, I wouldn’t say the average rust function contains them. Of course their frequency changes a lot depending on context, but in my experience most functions I write/read don’t have lifetime annotations at all.

              Yes, what you wrote somewhat resembles rust. But it is in no way average rust code.

        • flamingo_pinyata@sopuli.xyzOP
          link
          fedilink
          arrow-up
          15
          ·
          11 hours ago

          I don’t know if anyone would argue Rust macros are beautiful. If someone does they should be checked out by a doctor.
          Speaking as a fan of Rust.

    • Sunrosa@lemmy.world
      link
      fedilink
      arrow-up
      12
      arrow-down
      2
      ·
      17 hours ago

      One of the reasons i find it so hard to use non-Rust languages is how ugly they typically are by comparison. “fn” instead of “function” is such a great example of saving key presses where they’re most needed. And you get very used to seeing compact abbreviations. Idk if that’s what you’re talking about though.

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        7
        arrow-down
        3
        ·
        12 hours ago

        Rust:

        fn getofmylawn(lawn: Lawn) -> bool {
            lawn.remove()
        }
        

        C:

        bool getofmylawn(Lawn lawn) {
            return lawn.remove();
        }
        

        With Rust you safe 1 char, and gain needing to skip a whole line to see what type something is.

        • fruitcantfly@programming.dev
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          3 hours ago

          With Rust you safe 1 char, and gain needing to skip a whole line to see what type something is.

          Honestly, the Rust way of doing things feels much more natural to me.

          You can read it as

          1. Define a function,
          2. with the name getoffmylawn,
          3. that takes a Lawn argument named lawn,
          4. and returns a bool

          Whereas the C function is read as

          1. Do something with a bool? Could be a variable, could be a function, could be a forward declaration of a function,
          2. whatever it is, it has the name getoffmylawn,
          3. there’s a (, so all options are still on the table,
          4. ok, that’ a function, since it takes a Lawn argument named lawn, that returns a bool
        • chunes@lemmy.world
          link
          fedilink
          arrow-up
          4
          ·
          10 hours ago

          So that’s why people like C-style return types. That actually makes a lot of sense. I do too now.

          • Ephera@lemmy.ml
            link
            fedilink
            English
            arrow-up
            6
            ·
            9 hours ago

            To be honest, I think, they both have their place. In Rust, you typically wouldn’t return just a bool, but rather the element that you removed, so like this:

            fn getofmylawn(lawn: Lawn) -> Option<Teenager> {
                lawn.remove()
            }
            

            And then with such a more complex return-type, C-style means that you can’t see the function name right away:

            Option<Teenager> getofmylawn(Lawn lawn) {
                return lawn.remove();
            }
            

            I also really don’t think, it’s a big deal to move your eyes to the ->

            • fruitcantfly@programming.dev
              link
              fedilink
              arrow-up
              2
              ·
              3 hours ago

              Amusingly, modern C++ allows you to copy the rust signature nearly 1:1:

              auto getofmylawn(Lawn lawn) -> Option<Teenager> {
                  return lawn.remove();
              }
              
              • Ephera@lemmy.ml
                link
                fedilink
                English
                arrow-up
                1
                ·
                2 hours ago

                Huh, did that emerge out of unrelated design decisions or did they just figure
                why not both?

                • fruitcantfly@programming.dev
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  2 hours ago

                  I believe that it is useful in a few places. cppreference.com mentions templates as one case:

                  Trailing return type, useful if the return type depends on argument names, such as template<class T, class U> auto add(T t, U u) -> decltype(t + u); or is complicated, such as in auto fpif(int)->int(*)(int)

                  The syntax also matches that of lambdas, though I’m not sure that adding another way of specifying regular functions actually makes the language more consistent, since most code still uses the old style.

                  Additionally, the scope of the return type matches the function meaning that you can do

                  auto my_class::my_function() -> iterator { /* code */ }
                  

                  instead of

                  my_class::iterator my_class::my_function() { /* code */ }
                  

                  which is kinda nice

          • [object Object]@lemmy.world
            link
            fedilink
            arrow-up
            1
            arrow-down
            1
            ·
            edit-2
            4 hours ago

            Ooh yeah, overall coding culture is definitely not affected by the preferred nomenclature for identifiers. The person who’s habituated to fn over function will absolutely never name their functions in the vein of chkdsk. The two are completely disconnected in the brain of the programmer who read too much K&R in their childhood and was irretrievably traumatized by it for life.

            • calcopiritus@lemmy.world
              link
              fedilink
              arrow-up
              1
              arrow-down
              1
              ·
              2 hours ago

              I’d say it’s much more influential the names of the identifiers of the standard library.

              A language with function keyword that names it’s stdlib functions strstr and strtok will inspire way worse naming than on that has fn keyword with stdlib functions str::contains and str::split.

              We could search for a random crate on crates.io and see what identifiers people actually use, or we could spread misinformation on Lemmy.

      • UnderpantsWeevil@lemmy.world
        link
        fedilink
        English
        arrow-up
        21
        arrow-down
        4
        ·
        21 hours ago

        Maybe they’re confusing the literal name with the language? Idk.

        I grew up on Perl and holy fuck… Rust is fine.

        • jackr@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          5
          ·
          13 hours ago

          Perl is ugly but great. It’s like shell scripting with a more solid programming language. I’d never use it outside of simple scripts in my os, but whenever I do use it it’s very fun. Anyway, yeah, rust looks fine to me. Maybe they are not very experienced with it? I know some of my programs used to have lines with just x.unwrap().unwrap().unwrap() or whatever, which is not pretty.

          • Ephera@lemmy.ml
            link
            fedilink
            English
            arrow-up
            3
            ·
            6 hours ago

            I know some of my programs used to have lines with just x.unwrap().unwrap().unwrap() or whatever, which is not pretty.

            That goes away with experience, though. At least, I can’t think of a reason why you’d nest three Results or Options. Normally, you would collate them right away.

            The most you see in the wild is something like Result<Option<_>> to express that a check can fail, but even if it doesn’t, then a valid result can still be that there is nothing there.

            If you don’t care that your program crashes (like .unwrap() does), then anyhow is the error handling library of choice. With it, you can just write a ? in place of an .unwrap() for practically any error type. And well, it automatically combines the errors, so you won’t be writing ??? either.

      • rtxn@lemmy.world
        link
        fedilink
        arrow-up
        17
        arrow-down
        9
        ·
        edit-2
        21 hours ago

        Enums and nested blocks. I understand the importance of Option and Result, but it’s fucking infuriating when I have to check and destructure the result of every function call and either bubble the result up the stack from six levels of nested if let blocks or risk Cloudflaring my program by using .unwrap(). And while I like being able to extract a return value from an if...else expression, the structure gets really convoluted when multiple if and match blocks are nested (of course each one returning a value), and it gets completely fucked once closures are introduced.

        I like Rust, but calling it pretty is delusional.

        • calcopiritus@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          1 hour ago

          Most of the times you can just let ... else (which is basically a custom ? if you need if let ... else it’s because you actually need 2 branching code paths. In any other language you also do if ... else when you have 2 different code branches. I don’t see why this is a rust-specific issue.

        • SorryQuick@lemmy.ca
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          5 hours ago

          You can also use let else.

          let (Some(count\_str), Some(item)) = (it.next(), it.next()) else {
              panic!("Can't segment count item pair: '{s}'");
          };
          

          But really it’s the exact same as other languages, it just forces you to handle it better. C-based languages will return 0/null/-1 and you’ll have to check all 3 of those because they might not mean the same thing. How is that better?

        • marcos@lemmy.world
          link
          fedilink
          arrow-up
          19
          arrow-down
          4
          ·
          21 hours ago

          have to check and destructure the result of every function call

          Learn how to use enum error types, how error bubbling works, and how to convert between Options and Results.

          It’s Rust you are talking about, not Go.

          • rtxn@lemmy.world
            link
            fedilink
            arrow-up
            6
            arrow-down
            7
            ·
            20 hours ago

            This isn’t about some feature of the language being good or bad. It’s about Rust being ugly or not. The things I mentioned will always look ugly in the source code.

            • 5C5C5C@programming.dev
              link
              fedilink
              arrow-up
              9
              arrow-down
              2
              ·
              15 hours ago

              It’s hilarious to me that people talk about “ugly” as if their opinions are objective.

              I found Rust unpleasant to look at for the first two weeks of learning it, and now that I’ve been using it professionally for three years I loathe when I need to read code in other languages.

              No other language can rival Rust in showing the exact information needed to understand the code — never too much and never too little — while being concise, correct, and handling all edge cases.

              You can be more concise in other languages, but it will come the loss of handling every little possible bug. You can be prettier in other languages, but it will come at the price of adding a lot of useless boilerplate.

              Of course there are cases where Rust can be verbose or confusing, but that’s when you’re doing very esoteric things that would be just as confusing in other languages.

              Like any opinion on aesthetics, how someone feels about the prettiness of a language will have far more to do with familiarity than with any objective metrics.

          • balsoft@lemmy.ml
            link
            fedilink
            arrow-up
            4
            arrow-down
            11
            ·
            edit-2
            20 hours ago

            Sadly there’s still no truly good way to handle errors in rust. TBH I’m not sure if we as an industry have figured out an efficient, foolproof, composable, not overly verbose way to handle errors, so it’s not entirely on Rust.

            • calcopiritus@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              1 hour ago

              Rust allows you to choose whatever method you want.

              • Early return propagating the error
              • Early return ignoring the error (maybe by returning a default value)
              • Explicit handling by if-else (or match) to distinguish between error and not error cases.
              • Early return and turn the error into another type that is easier to handle by the caller.
              • Assume there is no error, and just panic if there is. (.unwrap)

              There are only 2 error handling methods that you cannot do:

              • Exceptions
              • Ignore the error and continue execution

              And that is because both of them are bad because they allow you to do the second one, when .unwrap is just there and better.

              If your concept of “not ugly” is “I just want to see the happy path” then you either write bad code that is “not ugly” or write good code that is “ugly”. Because there is no language that allows you to handle errors while not having error handling code near where the errors are produced.

            • Ephera@lemmy.ml
              link
              fedilink
              English
              arrow-up
              2
              ·
              14 hours ago

              Yeah, I was gonna say, error handling easily makes up 80+% of the code paths, and depending on whether you’re building a library or service or script etc., different strategies are most suitable for how to deal with those code paths.

              In a script, you often just want it to crash. In a library, you want to make these code paths matchable, in case the user cares why something failed. And then you have the awkward in-between, which is that 99% of your application codebase will be used by your main-function like a library, but you don’t want to spend as much effort on error handling for that as a proper library does, in particular also because you know what all consumers of your application-library need to know.

              So, it’s kind of multiple different problems, with overlap, and people are hoping for one easy solution to cover all these problems.

        • Kacarott@aussie.zone
          link
          fedilink
          arrow-up
          9
          ·
          15 hours ago

          The majority of its syntax is very similar to many other languages. Can you give an example of a language with pretty syntax?

          • Lucy :3@feddit.org
            link
            fedilink
            arrow-up
            2
            arrow-down
            3
            ·
            13 hours ago

            Key point being, similar to some random languages. JS and Python Syntax don’t fit a typed and compiled language at all.

            Pretty syntax would probably be something like C, where not every single character already widely reserved for specific keywords (like !, ', =) is reused in completely random ways.

            • Kacarott@aussie.zone
              link
              fedilink
              arrow-up
              5
              ·
              edit-2
              11 hours ago

              Ah yes I also found macro syntax like vec![ and println!( to be a bit jarring at first. However I don’t know if I would say that C’s approach to macros is any nicer, with it’s #define magic

        • 5C5C5C@programming.dev
          link
          fedilink
          arrow-up
          3
          arrow-down
          5
          ·
          15 hours ago

          Being unable to give an actual example proves you’re just a foaming-mouth hater with nothing to contribute.

          • Lucy :3@feddit.org
            link
            fedilink
            arrow-up
            6
            arrow-down
            14
            ·
            13 hours ago

            From the first syntax examples on Wikipedia:

            fn main() {
                let foo = 10; 
                // Suddenly, types are implicit now. A safe language should never have implicit types (now it's the (IDEs) implementations judgement which type that is. Combined with the variable shadowing "feature", this seems like a major clusterfuck. Now the IDE is the sole thing to tell you that you totally fucked up the logic, and both declarations/definitions (well which one is it? Would be nice to always have a direct KEYWORD telling you which type this fucking variable has. But no, the lazy piece of shit Rust 'programmer' left that as an exercise to the dear reader. Because in they just need to leave that part out instead of explicitly stating "I'm a lazy piece of shit" by *instead* typing 'auto'.) This is just Python-level BS. Yes, I also hate C++ for its auto keyword - but at least it explicit.
                println!("The value of foo is {foo}");
                let foo = 20;
                println!("The value of foo is {foo}");
            }
            
            fn add_two(x: i32) -> i32 {
            // That is, again, the syntax of Python. Why? Because Python is explicitly untyped. So having types be a *literal* afterthought is Ok. They're fully optional anywhere there. Now we're in Rust. They're sometimes optional, sometimes not, but they're always preferred. Yet, they're also an afterthought, seemingly.
                x + 2
                // Implicit statements are bad. Very bad. They so much invite to glossing over stuff, especially when your brain expects to see something else. Also, having every statement ended with ;, except context blocks, but suddenly *not* having statements ending with ;, is fucking ugly (which is the entire point of this rant). It's completly inconsistent. Which in itself is a huge magnet for errors.
            }
            
            if x > 5 {
            // Now why would you leave the parantheses, which are a major contributor to readability, away. Or even allow this. Rust is just memory safe, like dozens of other mainstream languages, but continues by allowing, promoting and requiring hazardous practices.
                println!("value is greater than five");
            }
            

            Now I’m slowly getting annoyed from typing on phone (at least in nvim), and my throat gets clogged with mucus again.

            Remember, some of that are subjective preferences and opinions. And the core idea of Rust - fast but safe programs - is good, yet very obvious and not innovative at all, while the syntax and implementation (of cargo (yes I like to wait an hour for a simple webapp to compile because there aren’t binary crates and cargo just doesn’t multicore 99% of the time)) is subpar to something that’s hailed as the savior for everyone and everything by such a large cult.

            • calcopiritus@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              52 minutes ago

              “not having mandatory parenthesis in if statements is hazardous, so I prefer to write C instead of rust, because I really care about safety” < that’s how you sound.

            • fruitcantfly@programming.dev
              link
              fedilink
              arrow-up
              2
              ·
              1 hour ago

              In practice, type inference in Rust is not a problem since the language is so strongly typed. In fact, it is more strongly typed than both C and C++, and will force you to cast values explicitly in cases where C and C++ will happily mess up your variables without warning. The absence of type inference would also be a major pain, since nested types such as iterators can get quite complex and very verbose. If you’ve programmed using older C++ standards, then you know this pain

            • 5C5C5C@programming.dev
              link
              fedilink
              arrow-up
              14
              arrow-down
              1
              ·
              11 hours ago

              Types are not implicit, they’re inferred by the compiler when there is no ambiguity about what the type needs to be. This is a huge benefit for refactoring code and reducing maintenance. I acknowledge that sometimes you might care to know the exact type of the variable, and sometimes that’s not as easy for a human to infer as it is for the compiler, but every decent IDE will provide inline type hints for you. Interpreting code by reading it in plaintext is an exercise in masochism.

              Python is actually the opposite on this, and it’s one of Python’s worst characteristics. The type is unknown until runtime unless you annotate it, and then the annotation isn’t really enforced. It’s the worst of every dimension.

              C++11 introduced auto, and now the community is split between “almost always auto” and “never auto”.

              JavaScript needed a whole new compiled language (Typescript) to fix its type system problems, and Typescript is only an incremental improvement at best.

              Rust has the best type system of any modern language by far. If you’re tripped up by not always seeing the type declarations then you’re either focusing on the wrong details in the code or you just need a little more practice. The key thing that needs to sink in for new Rust users is that the compiler is always providing safety rails. That means it’s no longer your job to verify that every aspect of the code is correct. You can relax a little and actually have something akin to duck typing without all the pitfalls that usually come with it.

              • Shanmugha@lemmy.world
                link
                fedilink
                arrow-up
                1
                arrow-down
                2
                ·
                11 hours ago

                Sorry for intrusion, but mhm, nah. I get it there are people who want to play around and have language/compiler babysit them, but there are also people like me who want to see exactly what something is. So no, Rust, just like JavaScript, can be liked by some people, but it is in no way something that has “best type system”

                There actually is no such thing as best type system, same way there is no such thing as best language

                • [object Object]@lemmy.world
                  link
                  fedilink
                  arrow-up
                  3
                  ·
                  7 hours ago

                  If you don’t realize that x = 10 denotes an integer of some default length, and that y = 10.0 is a float, then the language isn’t the problem.

                • 5C5C5C@programming.dev
                  link
                  fedilink
                  arrow-up
                  6
                  ·
                  9 hours ago

                  I get it there are people who want to play around and have language/compiler babysit them, but there are also people like me who want to see exactly what something is.

                  This is a false dichotomy when it comes to Rust. Despite everything I said and despite Lucy’s complaint, there is nothing that actually stops someone from explicitly annotating the exact type when declaring a variable. It’s just not required by the language, and most developers eventually realize that it’s not actually useful.

                  You’re right that these preferences are subjective, be although much of that subjectivity has more to do with how our past experiences have shaped what we’re familiar with, rather than any intrinsic characteristics of person. By that I mean, someone who uses Rust enough will most likely come to like the way the general community styles its code, sooner or later. In the meantime you’re welcome to do things in a way that suits your needs.

                  The only thing that Rust’s type system is weak on is runtime reflection. There are ways to achieve it within Rust’s type system, but it’s considerably more work than what you get in Python and JavaScript. Imo the only reason to choose a language other than Rust for a greenfield project is if you have a strong need for runtime reflection all over the place and aren’t very concerned about performance, threading, or avoiding entire categories of bugs that the Rust compiler protects you from.

            • [object Object]@lemmy.world
              link
              fedilink
              arrow-up
              10
              arrow-down
              1
              ·
              12 hours ago

              If you don’t understand how having any statement be an expression is useful, you don’t have enough experience to criticize programming languages.

      • Lucy :3@feddit.org
        link
        fedilink
        arrow-up
        4
        arrow-down
        11
        ·
        13 hours ago

        Average Rust code:

        macro_rules! sum {
            ( $initial:expr $(, $expr:expr )* $(,)? ) => {
                $initial $(+ $expr)*
            }
        }
        
        fn remove_prefix<'a>(mut original: &'a str, prefix: &str) -> &'a str
        
        let mut up = 1;
            'outer: loop {
        

        This is on the level of the esolang I made at 8 y/o, with random characters denoting random actions everywhere, at random positions.

        • 5C5C5C@programming.dev
          link
          fedilink
          arrow-up
          14
          arrow-down
          1
          ·
          11 hours ago

          It’s incredibly disingenuous to call this average Rust code and further erodes your credibility. I may as well point to hundreds of lines of preprocessor macros in a C++ header and call it average C++ code.

          This is not what an average Rust developer is writing 99% of the time. If someone on my team submitted a PR with an implementation of sum that uses macro_rules! I would almost certainly reject it.

        • Ethan@programming.dev
          link
          fedilink
          English
          arrow-up
          15
          arrow-down
          5
          ·
          19 hours ago

          Indentation-driven control flow is one of the most cursed things ever invented, excluding things explicitly designed to inflict pain or death.

          • KSP Atlas@sopuli.xyz
            link
            fedilink
            arrow-up
            3
            ·
            13 hours ago

            Haskell has the choice of both indentation based and brackets for things like do blocks, but most people use indentation based cause it’s the norm and looks cleaner

      • tyler@programming.dev
        link
        fedilink
        arrow-up
        14
        arrow-down
        3
        ·
        20 hours ago

        List comprehensions are much stranger than tabs vs spaces. There are very very very few languages that use them, and python’s is by far the worst out of the popular ones.

          • unit327@lemmy.zip
            link
            fedilink
            arrow-up
            6
            ·
            10 hours ago

            The concept of a list comprehenshion is sinple but syntax is awful, as if Yoda was writing a for loop. “x for x in y it is, hmm yes”.

      • aloofPenguin@lemmy.world
        link
        fedilink
        arrow-up
        5
        arrow-down
        4
        ·
        20 hours ago

        This is the one thing I hate about python, because the spacing would differ between editors. I used vim to create the files on one system, and geany to edit them on another. Via uses 8 spaces in a tab (at least for me), while geany uses 4. This makes python mad, and drives me crazy.

        Also, the rules for whitespace separation between things like loops, methods, and the rest of the code is annoying/ wierd (at least to me).

        • who@feddit.org
          link
          fedilink
          English
          arrow-up
          15
          ·
          18 hours ago

          Via uses 8 spaces in a tab (at least for me), while geany uses 4.

          You know that editors let you change their defaults, right?

          • Eager Eagle@lemmy.world
            link
            fedilink
            English
            arrow-up
            4
            ·
            edit-2
            16 hours ago

            and that indentation defaults in decent editors are usually language dependent. I’m not familiar with these editors, but… come on - if they use one default for all files, OP should use a better tool.

          • aloofPenguin@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            17 hours ago

            Yes, but I don’t normally program in python, so I never did. When I had to, I never thought of changing it (it wasn’t for long anyways and was less of a thought out decision to do programming in vim)

  • Gonzako@lemmy.world
    link
    fedilink
    arrow-up
    14
    ·
    20 hours ago

    I like using python just cuz I can quickly get it working. I wish I had the time to undust C and try getting that to do what I want but my work cares more about iteration and speed to implement than speed of the program itself.

  • palordrolap@fedia.io
    link
    fedilink
    arrow-up
    13
    arrow-down
    1
    ·
    21 hours ago

    This is pretty smart for the left guy. He’s usually down at the level of “HTML is a programming language” or “What’s a programming language?”.

    That said, the first one of those isn’t mutually exclusive with what he says in the meme.

    • flamingo_pinyata@sopuli.xyzOP
      link
      fedilink
      arrow-up
      13
      arrow-down
      1
      ·
      21 hours ago

      It mostly reflects my own story. From a beginner enthusiast of multiple “cool” languages (Scala was all the rage back then), through considering myself more “mature” and thinking about business priorities, ending at understanding that using a good programing language is a business priority.

      If the team works with a language they enjoy, they will be happier (and more productive). Doesn’t even matter if the code is written by humans or machines.

  • SmokeyDope@piefed.social
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    20 hours ago

    I’m only a hobbyist no skin in the game but as an engineer first programmer second I feel like how you design the architecture of your logic and how you choose to prioritize computational optimization or feature implementation have a much bigger impact than language. Obviously theres a time and place like using luajit instead of lua if you really need that speed boost, but in big complex programs I’m willing to bet lazy programmers skip optimization steps and copy paste thousands of lines to ship quickly regardless how performance optimized the underlying language is.

    I make a module that does a specific thing for version 1, after initial bug patches and maybe a feature addition theres usually an epithany that the logic can be generalized into an api type registry structure that allows the code to be reused and configured as needed on per item basis. Along the way you do stuff like ask what the not expensive calls are, add accumulator timers to reduce unneeded CPU usage , ensure early returns are up top when it makes sense, choosing to render a cleverly crafted sprite instead of a full 3d entity.

    A conditional if then logic loop Is a logic loop no matter what Turing complete language its written in. What really matters is how you use the loop not which syntax its written in.

    • theneverfox@pawb.social
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 hours ago

      It’s extremely important, because you’re never really picking a programming language, you’re picking a stack

      You can technically write an android app in Python, but should you? You’re now locked into a framework used to run apps in Python, which are going to be much more limiting than other languages and frameworks. But you’ll also have access to Python libraries, which gives you options in that direction

      Then you examine the context. How good are you at learning other languages? How long/complicated is what I want to do? Does this need to be performant? How long do I need to keep this working?

      And most importantly, and you really have to think this one through… Will I need to extend the original goals in the future?

      So really, yes, it’s very important. A bad decision in the beginning could cause problems for decades

    • Caveman@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      11 hours ago

      You make a fair point, programming skill is more important than language but picking a programming language is still important in a lot of cases.

      Ecosystem size can reduce “reinvent the wheel” code.

      Some languages just have dogshit performance like Ruby, lua is pretty good though and it absolutely matters when you have to crunch a lot of data. Access to developers is big since you ideally want to find someone with experience in the language your project is in.

      Some languages like Rust are very good for making safe code but very bad if you want to get out a microservice fast. I could make an equally correct version of some adapter in a fourth of the time in python compared to rust and I know them similarly well.

      Then there’s low RAM requirements like embedded devices, it’s best to run something that compiles to machine code and doesn’t need a big runtime. Java and C# become almost useless in very low RAM environments and you’d have to use Zig, C or Rust instead.

      So long story short, depending on what you’re writing it can just not matter or matter a lot.

    • Ethan@programming.dev
      link
      fedilink
      English
      arrow-up
      12
      ·
      19 hours ago

      Any function can be written in any Turing complete programming language. That doesn’t mean a sane person would use malboge or brainfuck for a production system. Language choice can have a huge impact on productivity and maintainability and time is money.

    • expr@piefed.social
      link
      fedilink
      English
      arrow-up
      7
      ·
      18 hours ago

      No one actually copy/pastes thousands of lines of code. We use libraries.

      Languages do matter a lot. Yes, they are all technically equivalent, but the craft of software engineering is much, much more about social/cultural/community considerations than it is computational ones. What the community around a programming language values matters, because it informs a great deal about what’s idiomatic in a language, what libraries are available, what kind of bugs are possible (or not), how easy code is to read, comprehend, and maintain, and much more.

      What makes a language good is not what programs you can write in it, but how it constrains what you can do such that you naturally writing good code. For example, null pointer exceptions (or segfaults in C, etc.) are a classic problem that plagues many mainstream languages like Java, C#, Python, etc. In Haskell (and a handful of other languages, including Rust), null pointer exceptions are not possible, because nulls do not exist in these languages. Taking away this language “feature” actually increases the power of the language, because you can guarantee that a certain class of common bugs are not possible in your program. So languages that restrict known bad programming practices lead to programmers writing better programs and, more generally, a community around the language that resonates with these philosophies.

    • AnarchoSnowPlow@midwest.social
      link
      fedilink
      arrow-up
      7
      ·
      19 hours ago

      “We have decided that we will use deck screws to build our deck, it’s the right pattern and architecture for the job. Now get started with this hammer, the tool you use doesn’t matter as long as it’s functional as a tool. If it’s not working well that’s an optimization problem because you’re bad at your job.”

  • UnfortunateShort@lemmy.world
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    15
    ·
    21 hours ago

    The most important thing is using Rust, be it only to avoid calls for a rewrite in Rust by people like me

    • Ethan@programming.dev
      link
      fedilink
      English
      arrow-up
      8
      arrow-down
      14
      ·
      19 hours ago

      Keep your Rust to yourself. I don’t care what language someone else uses for their projects but Rust is an unreadable mess that I don’t want anywhere near my projects.

      • UnfortunateShort@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 hours ago

        Rust is an unreadable mess to you because you can’t read it. It has a steep learning curve, but the reward is one of the most reliable and efficient languages ever created.