• zacher_glachl@lemmy.world
    link
    fedilink
    arrow-up
    46
    arrow-down
    3
    ·
    1 year ago

    As a python developer and user of websites, please no. The web is already a slow mess and my laptop is already spinning up fans on some websites that really shouldn’t do anything much more complicated than load text and images from a database and display them. CPython would make it exponentially worse. At least pick a sensible performance focused implementation.

  • CanadaPlus@futurology.today
    link
    fedilink
    English
    arrow-up
    53
    arrow-down
    11
    ·
    edit-2
    1 year ago

    Yes. Please. Although something strongly typed would be even better. It’s ridiculous the world runs on a language built in 2 weeks.

    • Virkkunen@kbin.social
      link
      fedilink
      arrow-up
      42
      arrow-down
      2
      ·
      1 year ago

      It’s also ridiculous to think it’s still the same language that was built in two weeks, like absolutely no work was done in it over time.

      • CanadaPlus@futurology.today
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        12
        ·
        edit-2
        1 year ago

        I’ll admit I don’t really know the history of the language between then and now. Please don’t tell me the crazy stuff was somehow added later.

        • Kayn@dormi.zone
          link
          fedilink
          arrow-up
          4
          arrow-down
          1
          ·
          1 year ago

          If you don’t know the history, why are you so confidently talking about JavaScript being built in 2 weeks?

          • CanadaPlus@futurology.today
            link
            fedilink
            English
            arrow-up
            2
            arrow-down
            2
            ·
            edit-2
            1 year ago

            I’m familiar with the early history, I’ve dabbled in it in modern times, and of course I’ve seen all the ways it’s bad memed about ad-infinitum (and have to agree).

            I didn’t really think I had to be able to write a book on it to say it doesn’t deserve the use it gets, and I don’t think it’s outrageous to imagine that there’s a connection with the hasty genesis. So, I mentioned that off-hand. If it’s actually unconnected my bad.

            • Kayn@dormi.zone
              link
              fedilink
              arrow-up
              3
              arrow-down
              1
              ·
              edit-2
              1 year ago

              The memes are annoying because most of the complaints are superficial.

              “Look, "b" + "a" + +"a" + "a" outputs "baNaNa"! JavaScript bad!” Yeah, that’s what happens. Just don’t do that thing that obviously doesn’t look right. Don’t use var, just like every modern JavaScript learning resource will tell you. Don’t use == if you don’t intend for type coercing to happen.

              If you don’t write bad code on purpose, JavaScript is fine.

              • CanadaPlus@futurology.today
                link
                fedilink
                English
                arrow-up
                4
                arrow-down
                1
                ·
                1 year ago

                If coding teaches you anything well, there’s no bound to the different ways you can screw up. Don’t use bad languages on purpose.

    • DarkenLM@kbin.social
      link
      fedilink
      arrow-up
      26
      ·
      1 year ago

      And yet somehow it evolved to become something that will last to the heat death of the universe.

      I’ve grown used to it with time, though. Once you know it’s “quirks”, it’s not so bad.

      • CanadaPlus@futurology.today
        link
        fedilink
        English
        arrow-up
        5
        arrow-down
        1
        ·
        1 year ago

        I guess the internet just grew that fast. The first arrival took all and locked everybody in.

        Now, we have just two browsers that are widely used, so maybe we do have an opportunity to go back and fix it. Go sounds like it’s a pretty popular choice for statically typed, imperative high-level language.

        • DarkenLM@kbin.social
          link
          fedilink
          arrow-up
          17
          arrow-down
          1
          ·
          1 year ago

          Honestly, given the context of a browser, Javascript’s “Everything is better than crashing” philosophy does not seem too out-of-place. Yes, the website might break, but at least it would be theoretically usable still.

          Yes, a statically typed language would help, but I’d rather not have one that is “these two types are slightly different, fuck you, have a segfault”, but rather one that is slightly more flexible.

          • CanadaPlus@futurology.today
            link
            fedilink
            English
            arrow-up
            5
            arrow-down
            1
            ·
            edit-2
            1 year ago

            Actually, that’s a good point, in scripting fatal type errors can happen at runtime. I guess Python is the right choice then, given it’s maturity and popularity, and then you can code the complex stuff in whatever you want via WASM like other people mentioned.

      • CapeWearingAeroplane@sopuli.xyz
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Not even “not so bad”, I would say that as a scripting language it’s fantastic. If I’m writing any actually complex code, then static typing is much easier to work with, but if you want to hack together some stuff, python is great.

        It also interfaces extremely easily with C++ through pybind11, so for most of what I do, I end up writing the major code base in C++ and a lightweight wrapper in Python, because then you don’t have to think about anything when using the lib, just hack away in dynamically typed Python, and let your compiled C++ do the heavy lifting.

    • words_number@programming.dev
      link
      fedilink
      arrow-up
      25
      ·
      1 year ago

      Python is actually mostly strongly typed. Strongly (e.g. can’t use a number as a string without explicitly converting it), but dynamically (can change type of variable at runtime). You probably would prefer a statically typed language and I agree.

      • CanadaPlus@futurology.today
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        edit-2
        1 year ago

        Alright, thanks for the help with terminology. I’m a bit confused about changing types at runtime. I thought a compiled or interpreted language stopped having types at runtime, because at that point it’s all in assembly. (In this case of course it’s scripting, which someone pointed out to me elsewhere)

        • CapeWearingAeroplane@sopuli.xyz
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          That’s a compiled language, an interpreted language is translated to assembly at runtime, in pythons case: pretty much one line at a time.

          Disclaimer: To the best of my knowledge, please correct me where I’m wrong.

          • Skyhighatrist@lemmy.ca
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            1 year ago

            That’s really only native compiled languages. Many popular languages, such as C#, Java, etc. Lie somewhere in between. They get compiled to intermediary byte code and only go native as the very final step when running. They run in a runtime environment that handles that final step to execute the code natively. For .NET languages that’s the CLR (Common Language Runtime).

            For .Net the process goes like this:

            • You write the code
            • Code is compiled to MSIL
            • At runtime when the MSIL is executing a JIT (just-in-time) compiler translates the MSIL into native code.
            • The native code is executed.

            Java has a similar process that runs on the JVM. This includes many, many languages that run on the JVM.

            JavaScript in the browser goes through a similar process these days without the intermediary byte code. Correction, JS in modern browsers also follow this process almost exactly. a JIT compiler compiles to bytecode which is then executed by the browser’s JS engine. Historically JS has been entirely interpreted but that’s no longer the case. Pure interpreted languages are pretty few and far between. Most we think of as interpreted are actually compiled, but transparently as far as the dev is concerned.

            Last, but certainly not least, Python is also a compiled language, it’s just usually transparent to the developer. When you execute a python program, the python compiler also produces an intermediary bytecode that is then executed by the python runtime.

            All that being said, I welcome any corrections or clarifications to what I’ve written.

          • CanadaPlus@futurology.today
            link
            fedilink
            English
            arrow-up
            1
            arrow-down
            1
            ·
            edit-2
            1 year ago

            I did know the difference, but I didn’t realise it ran one line at a time! I had kind of assumed it at least did one pass through everything before giving output. Thanks.

            • CapeWearingAeroplane@sopuli.xyz
              link
              fedilink
              arrow-up
              1
              ·
              1 year ago

              I believe it does “one pass” when it loads the code into ram, because syntax errors can be caught before anything runs. But I think the actual interpretation happens pretty much one line at a time :)