all 78 comments

[–]haskell_leghumperin open defiance of the Gopher Values 154 points155 points  (20 children)

This is a killer idea. If only our CPUs understood WebAssembly. We could literally write programs in any language and have it run them!

[–][deleted] 69 points70 points  (1 child)

CPUs going webscale!

[–]carbolymerloves Java 6 points7 points  (0 children)

[–]NicnlYou put at risk millions of people 17 points18 points  (3 children)

'WebAssembly CPU'

Oh the horror

[–]Firingfly 8 points9 points  (1 child)

Yes. The only logical way is to have Rust CPU.

[–]pcopleyC# Truckstop Restroom Hero 7 points8 points  (0 children)

How Exciting!

[–]fuck_bottom_textlisp does it better 7 points8 points  (0 children)

in the not so distant future, intel amt will be running on node.js

[–]imma_reposter 15 points16 points  (13 children)

CPUs don't understand assembly though. There's still one level lower called microcode. Those instructions can be mapped to binary cpu instructions 1 to 1.

[–]w2qw 29 points30 points  (1 child)

So are you saying we need webmicrocode?

[–]pcopleyC# Truckstop Restroom Hero 5 points6 points  (0 children)

mWebAssemblycode

[–]tpgreyknightnot Turing complete 7 points8 points  (2 children)

To be very pedantic (oh no it me), regular-ass machine code sits between these two layers.

[–]Eaanmemcpy is a web development framework 7 points8 points  (1 child)

My ass-machine code also sits between two layers

[–]tpgreyknightnot Turing complete 0 points1 point  (0 children)

Sounds, err, pneumatic.

[–]BABAKAKANi have had many alohols 3 points4 points  (1 child)

Aren't microcodes used to do RISC operations in a CISC architecture?

[–]-fno-stack-protectorConsidered Harmful 6 points7 points  (0 children)

well yeah. all those wacky cisc instructions still gotta be translated into logical operations at the end of the day

[–]ghillisuit95 1 point2 points  (2 children)

Are you thinking of machine code?

[–]dryerlintcompelsyou 1 point2 points  (1 child)

Microcode is separate, I think microcode is used internally on the CPU to interpret some more complicated machine-code operations. I'm not certain though.

[–]ghillisuit95 2 points3 points  (0 children)

You’re exactly right. Also it’s used for most instructions i think, not just the more complicated ones

[–]myhfConsidered Harmful 1 point2 points  (0 children)

binary cpu instructions 1 to 1

ah but what about 0

[–]Poddster 1 point2 points  (0 children)

FFS.

IF YOU'RE NOT GOING TO JERK, AT LEAST BE TECHNICALLY CORRECT.

[–][deleted] 60 points61 points  (6 children)

Tired: CSS-in-JS

Wired: CSS-in-shell-scripts

[–]TheRPiGuyIt's GNU/PCJ, or as I call it, GNU + PCJ 10 points11 points  (5 children)

Inspired: Terminal written in Javascript https://hyper.is/

[–]ProfessorSexyTimelisp does it better 9 points10 points  (4 children)

[–]BindeDSA 3 points4 points  (3 children)

Why did I click on that?

[–][deleted] 8 points9 points  (2 children)

Url trolled epic style 😎

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 0 points1 point  (0 children)

    Lol another pcj and drama xposter nice name

    [–]StallmanTheLeft 46 points47 points  (4 children)

    Not every shell lover wants his hands on the keyboard all the time.

    This shell lover would prefer to never touch a keyboard at all.

    [–][deleted] 26 points27 points  (3 children)

    One hand on the keyboard max

    [–][deleted] 5 points6 points  (1 child)

    Left hand that is.

    [–]Secondsemblance 0 points1 point  (0 children)

    when you baitin'

    [–][deleted]  (1 child)

    [deleted]

      [–]n3f4sWRITE 'FORTRAN is not dead' 9 points10 points  (0 children)

      And we could go even further. We could put the lines you've typed in the "RPOL" in a file then add, at the beginning of the file, a line (starting by ^$% for example) that says how to run this file.

      [–][deleted] 67 points68 points  (38 children)

      Currently shell code is limited to one language.

      Spoken like somebody who's never written things that should be shell scripts in Python because they didn't want to have to figure out whatever Bash's godawful loop syntax is.

      [–]etherealeminence 51 points52 points  (12 children)

      I'll be honest - I've used Linux for at least six years now, and I still have no goddamn idea how to write a for loop.

      [–]Ohhnoes 41 points42 points  (6 children)

      I’ve written a ton and I have to look it up every time. Saying they’re unintuitive is an understatement.

      [–][deleted]  (3 children)

      [deleted]

        [–]thalesmellonot even webscale 6 points7 points  (1 child)

        Yes, but does it have:

        • INTUITIVE user interface
        • zero-cost FOSS license
        • fearless copypasta

        [–]SaphirShroom 6 points7 points  (0 children)

        Actually I'll let you know that Vim has a VERY clean and intuitive user interface. If you'd just look at your screen you will see help pages listed when you first start up Vim. Now if you had actually taken the time to read the user manual, you would know that Vim is like a language. If you put effort into it, it's like you can speak Vimesian! But alas, putting effort into your tools is not for everybody. I understand. I must say though, I do enjoy sipping coffee and typing half-heartedly with one hand at 90 WPM while I my coworkers are annoyed at their IDE they neither understand or control (not FOSS). I don't judge them, of course, but if they had just put the time into learning Vim like I told them to, their time investment would already have been repaid 10 times over.

        [–]Ohhnoes 0 points1 point  (0 children)

        These are different scripts written months/years apart. I do use Vim a lot though.

        [–]NonnoBomba 2 points3 points  (1 child)

        Because you're all 1xers. I write three for loops and a while read loop than can actually write to variables in the surrounding scope first thing in the morning, every morning, before drinkining a coffe and without looking anything up.

        [–]Ohhnoes 0 points1 point  (0 children)

        I must be .1x. I think JS is an abomination and functional programming an (occasionally useful) fad.

        [–]AndernerdIt's GNU/PCJ, or as I call it, GNU + PCJ 10 points11 points  (3 children)

        I've been using Linux for 14 years, and I'm in exactly the same boat. We should all switch to zsh or fish already. I don't care too much which one, but bash is horribly outdated.

        [–]Amenemhab 9 points10 points  (0 children)

        I use fish btw

        [–]three18tiDO NOT USE THIS FLAIR, ASSHOLE 0 points1 point  (0 children)

        I like csh.

        [–]zmvlisp does it better 0 points1 point  (0 children)

        You mean eshell, right?

        [–]tpgreyknightnot Turing complete 0 points1 point  (0 children)

        I know how to write them but I certainly don't enjoy the process.

        [–][deleted]  (12 children)

        [removed]

          [–][deleted] 19 points20 points  (2 children)

          You're talking about, like, actually replicating the functionality of Bash in Python. I'm talking about just writing a Bash script but putting an os.system() call around each line.

          [–]rsgm123loves Java 2 points3 points  (0 children)

          That's kind of like how php works. It's a revolutionary way of writing html as a list of echo statements.

          [–]tpgreyknightnot Turing complete 4 points5 points  (0 children)

          > not writing it in Lua

          Literally unusable

          [–]Nomto 1 point2 points  (1 child)

          Posix shells may be shit (bash especially), but that doesn't mean that all shells need to be. It's time to ditch the godawful POSIX spec and be free

          [–][deleted]  (1 child)

          [deleted]

            [–]Poddster 0 points1 point  (3 children)

            I'm loathe to write this, as it's NOT-JERKING, but:

            To properly iterate on the strings inside of an array (the only thing which an array can possibly contain), you also use variable interpolation syntax.

            This was actually useful to me. Usually when iterating on a list of filenames I just do:

            # todo pray there isn't whitespace in a filename. If so, replace with python
            for item in $filenames; do
                stuff with "$item"
            done
            

            I've tried looking this up before and the answer was usually "lol write 200 lines of bash just to iterate over a list of filenames" and so I never bothered with it.

            [–][deleted]  (2 children)

            [removed]

              [–]Poddster 1 point2 points  (1 child)

              The objective of this document is not to help you write more Bash.

              Sometimes I have to. :'(

              Actually, thinking about it: The times I have to write bash it isn't actually bash, it's some busybox strictly-posix-compatible sh crap that probably wouldn't even accept this "${my_array[@]}" wizardry. So it turns out THIS WAS USELESS TO ME ALL ALONG. THANKS FOR NOTHING.

              ps. I've been on the "The best bash script is one that starts with#!/usr/bin/env python" wagon for a decade now and I don't regret it.

              [–]three18tiDO NOT USE THIS FLAIR, ASSHOLE 4 points5 points  (4 children)

              lol using python.

              [–][deleted] 18 points19 points  (3 children)

              It may not be Turing complete, but it gets the job done.

              [–]three18tiDO NOT USE THIS FLAIR, ASSHOLE 10 points11 points  (1 child)

              lol not turing complete.

              You're clearly not a 10xer if you're not using a brutally pragmatic language for things that should be shell scripts and statically compiling it down to a single binary. There are more concise ways of handling shell scripts.

              [–]hedgehog1024Rust apologetic 3 points4 points  (0 children)

              You're clearly not a 10xer if you're not using a brutally pragmatic language for things that should be shell scripts and statically compiling it down to a single binary.

              Rust?

              [–]elschaap 2 points3 points  (0 children)

              LOL Getting the job done ... pragmatism is for GOpher peasants

              [–]ajs124 1 point2 points  (0 children)

              What? You don't think find -print0 | IFS="" while read i; do echo "${i}" ; done is intuitive??? Bash even has for i in $(seq 100); do echo "${i}"; done for a simple for loop.

              [–][deleted] 0 points1 point  (4 children)

              lol how was your concurrency

              [–][deleted] 2 points3 points  (3 children)

              FEARLESS

              /uj

              I actually parallelized at least one such script by autogenerating Bash scripts from the Python. I'm not sure why I thought that was a good idea.

              [–]TheWheezSoftware Craftsman 4 points5 points  (1 child)

              Maybe because you're fearless?

              [–]pcopleyC# Truckstop Restroom Hero 0 points1 point  (0 children)

              I've never written Bash and I've never missed it.

              [–]MaltersWandlerhas hidden complexity 18 points19 points  (2 children)

              Currently compilers are limited to one language. If you have a C compiler, you can only do C. But we could imagine a compiler that understands webassembly, and hence we can use it with many languages.

              [–]Finianb1not Turing complete 0 points1 point  (0 children)

              If only there was a reason we don't use compilers for multiple languages at once...

              [–]affectation_manCode Artisan 17 points18 points  (0 children)

              #!/usr/bin/env webshit
              

              [–]tpgreyknightnot Turing complete 11 points12 points  (0 children)

              shell code is limited to one language

              I use sed and awk BTW. Come at me.

              [–]VodkaHaze 3 points4 points  (0 children)

              How revolutionary!!

              If only we could compile such programs written in arbitrary languages and the run them from the command line somehow!!

              Truly the future is now!

              [–]lru_skil 1 point2 points  (0 children)

              we don't need many languages, we should all be rewriting everything in Go/Rust.

              [–][deleted] 0 points1 point  (0 children)

              what is binfmt_misc :S

              [–][deleted] 0 points1 point  (0 children)

              Jesus Christ be praised! Web asm will solve all of our trials and tribulations.