Please dont take this seriously guys its just a dumb meme I haven’t written a single line of code in half of these languages

  • @[email protected]
    link
    fedilink
    191 year ago

    JS is basically the Hydra from the Greek Mythology.

    Though PHP is literally the problem had me lol.

  • xigoi
    link
    fedilink
    361 year ago

    Actual C: Problem → Segmentation fault

  • @[email protected]
    link
    fedilink
    English
    27
    edit-2
    1 year ago

    C:

    Problemreturn Solution;

    C++:

    Problem

    const [auto]&& (Problem&& problem) noexcept(noexcept( Solution<Problem>{}(std::forward<Problem>(problem)) )) { return Solution<Problem>{}(std::forward<Problem>(problem)); } -> decltype( Solution<Problem>{}(std::forward<Problem>(problem)) )
    
    • Venia Silente
      link
      fedilink
      English
      51 year ago

      But this doesn’t return the Solution. You don’t invoke the lambda.

      (Or does C++ have implied returns now? Last I heard there was implied move)

      • @[email protected]
        link
        fedilink
        English
        21 year ago

        Actually I do; it’s the {} that initializes the lambda, and the parenthesis after invokes.

        That said, it would have been fun.

    • @[email protected]
      link
      fedilink
      161 year ago

      I’ve seen this before but don’t accept it myself. There are cases where you just wanted to cat. In this case, maybe to review the problem. Then you want to extend the command. Preserving it in the next commands where you start stacking on pipes is useful since it can be fewer strokes and maintain a habit.

  • @[email protected]
    link
    fedilink
    91
    edit-2
    1 year ago

    Perl:

    Problem -> $ @ % <=> <> =()= => ; qw() ])} select(undef, undef, undef, 0.25) =~ tr/.?\w\sREg3xfr0mhe|l/foo/g; $|++ &homebrewedFunction(%$ref, $_ , @_ ) -> solution

    Source: I mainly code in perl. I like it, but I’ll be the first to admit that it’s not a beautiful language.

    I was about to make an entry for lisp here, but I don’t have enough parentheses to draw the path to the solution.

    • palordrolap
      link
      fedilink
      11
      edit-2
      1 year ago

      Over the top tone: “Pretty sure that won’t compile. $EVAL_ERROR modulo what you get from the filehandle called = isn’t an lvalue that can be put through the Goatse operator that I’m aware of.”

      But seriously(?), I’m almost certain that’s not how that would be parsed. = isn’t a valid bareword, so Perl would choke on the spaceship operator not being a term… I think.

      After testing… It’s worse. I think it’s parsing <> as the glob operator and = as a filespec.

      For those who don’t know Perl:

      Because of its appearance, <=> really is called the spaceship operator (at least, when it can be parsed as an operator and not whatever happened above).

      =()= by comparison has unofficially been called Goatse. If you don’t know what Goatse is, find out at your own risk. If you do know, you can see why this particular pseudo-operator was given that name.

      And if you’re still reading, =()= is a pseudo-operator because it’s not actually parsed as part of the syntax. It’s literally an assignment operator = followed by an empty list () followed by another assignment operator =, providing list context to the outside of the equals signs that wouldn’t otherwise be there.

      [Why are you still still reading?] Context is important in Perl. If a function returns a list of values (which is something Perl functions can do) and you try to store the result in a scalar variable, replacing the usual = with =()= will store the number of elements returned rather than the last element of the list.

      • @[email protected]
        link
        fedilink
        8
        edit-2
        1 year ago

        It’s not supposed to be compilable. It’s more intended as a list of weird looking (but valid and useful) perl stuff.

        As for the goatse operator, I’ve mostly used it for counting amount of regex matches.

        Oh, and I forgot the diamond operator. Added.

    • I Cast Fist
      link
      fedilink
      31 year ago

      I personally never understood how anyone could find Perl appealing or even “good” to program in, probably because I could never understand wtf the code was meant to do

    • @[email protected]
      link
      fedilink
      241 year ago

      Perl is write-only code. Larry Wall raised a monkey’s paw and asked for a language that works the way programmers want. So most Perl is the first thing someone tried, unfiltered by rigid syntax putting your thoughts in order, compiler warnings bringing side effects to mind, or even names forcing you to decide what a variable is. An uncommented Perl script is raw brain patterns displayed as ASCII.

      Thank god it runs like crap. We’d be in so much trouble if it was fast. Optimized C isn’t exactly gorgeous, but any project that compiles proves someone looked at the code more than once.

      • @[email protected]
        link
        fedilink
        111 year ago

        I love the term “write-only code”, it’s perfect. I used to love Perl as it felt like it flowed straight from my brain into the keyboard. What a free and magical language.

        So it turned out I had ADHD. Took meds, went back to C/++ with renewed appreciation, haven’t touched Perl since as it horrifies me to look at it. What a nightmare of dangling references and questionable typing. Any language that allows you to cast a string to a function and call it really needs to sit down and think about what it’s doing.

        • @[email protected]
          link
          fedilink
          61 year ago

          So it turned out I had ADHD.

          Genuine LOL. Yeah… yeah, that’s Perl in a nutshell. Creating Perl: ‘why aren’t all languages like this?!’ Editing Perl: ‘oh.’

          • @[email protected]
            link
            fedilink
            11 year ago

            As I said,

            C/++ with renewed appreciation

            No such thing as eval in non-interpreted languages. Unless you’re crazy enough to invoke the compiler and exec() the result.

            I used eval too in my Perl days which is why I specifically called it out. IMO any time you see eval used there should be another, more proper way to do it.

            • @[email protected]
              link
              fedilink
              1
              edit-2
              1 year ago

              I was joking, and definitely agree with you. I don’t think I’ve used eval since my first programming course in uni.

              Edit: Except for monkey hacks for laughs of course.

    • @[email protected]
      link
      fedilink
      English
      38
      edit-2
      1 year ago

      https://www.foo.be/docs/tpj/issues/vol4_4/tpj0404-0015.html

      The Perl Poetry Contest - The Perl Journal, Winter 1999

      #!/usr/bin/perl
      #
      # asylum.pl
      # by Harl

      close (youreyes);
      bind (yourself, fast);

      while ($narcosis) {
         exists $to($calm);
         not calm;
      }

      accept the, anesthesia;
      seek the, $granted, $asylum’
      and wait;

      stat ically;

      unlink and listen (in, $complicity);

      for (a, little) {
         system (“sync hronicity”);
      }

    • @[email protected]
      link
      fedilink
      111 year ago

      I was hired twice to write Perl, both times switched my department to something else after a few years.

      Perl is good for command line processing, and absolutely god awful read-only magic hacks. Nothing else.

  • idunnololz
    link
    fedilink
    21
    edit-2
    1 year ago

    It’s ironic that the illustration for JavaScript is probably the most realistic and best solution IRL. In the sense that a lot of what problem solving is (which is a big part of software engineer) is breaking a big problem into smaller problems. And you continue doing this until each problem is solvable in a short period of time.

    JavaScript sucks though as a language.

    • @[email protected]OP
      link
      fedilink
      61 year ago

      You’re completely correct. But what I meant by that graphic is “poor solutions leading to more problems”, not “breaking down problems into smaller ones”. It was inspired by a cube drone comic that made the same complaint, but I can’t find that particular comic now

    • @[email protected]
      link
      fedilink
      51 year ago

      JavaScript is a great language until you ask it to do more than toggle a div or send a request to the server

      • @[email protected]
        link
        fedilink
        11 year ago

        Typescript is wasted on JS. Currently getting a JS certification while porting an action script 3 project to JS, ActionScript 3 was the better language.

        • @[email protected]
          link
          fedilink
          11 year ago

          I dunno we run and service serval large application running with React TS as the client with C# Entity Framework for the Server with SQL and wrapped up nicely in GraphQL.

      • idunnololz
        link
        fedilink
        51 year ago

        I guess I have to defend this one. I personally think Typescript is the better language compared to typed Python or Ruby (two comparable languages based on how they are all used). Modern Javascript actually have a lot of nice language features, the only issue is the lack of types. Typescript doesn’t entirely solve the problem but it’s a decent attempt at it. A good typescript repo is decently readable, testable and performant enough for most use cases.

  • @[email protected]
    link
    fedilink
    English
    81 year ago

    PHP -> Problem -> Replace the developer -> Solution.

    Yes PHP was bad in 5.x, in 8.x if things go bad it’s just the developer who’s bad.

  • @[email protected]
    link
    fedilink
    1121 year ago

    PHP: Problem -> real_solution_for_real_this_time() (real_solution_i_swear() is unsafe and deprecated)

    • @[email protected]
      link
      fedilink
      271 year ago

      Eh, your statement is accurate for PHP4 and still relevant up to PHP5.2… We’re on PHP8.3 now and PHP8.0 is now out of security updates. I know it’s trend to hate on PHP but you’ve got to at least update your materials to var-vars… it’s like knocking node for having substr() and substring().

      • @[email protected]
        link
        fedilink
        111 year ago

        trend to hate on PHP

        2 years ago I tried to give a drupal project the ci/cd makeover (i.e. containers, test-deployments, reproducable builds, etc)… that’s when my hate was freshly renewed.

        At this point I think it’s ok to let a dead language die and move on to something else (anything else, really)

    • @[email protected]
      link
      fedilink
      English
      271 year ago

      Ever wanted to be somewhere inbetween java and JavaScript?

      Yeah, that’s Groovy. Only it’s the wrong groove

    • 👍Maximum Derek👍
      link
      fedilink
      English
      551 year ago

      I used to think Javascript was hell when I barely used it. Now I have to build with it regularly and… once in a while I’m just right about things.

    • @[email protected]
      link
      fedilink
      81 year ago

      What makes JavaScript so widely disliked? I know very little of it, and in skimming different stuff I think I’ve seen like a million different frameworks for it, so is that a part of it?

    • @[email protected]
      link
      fedilink
      151 year ago

      JS is ironic punishment as a programming language. It’s fun to screw around in! And then you have to use it for stuff, and pain ensues.

  • @[email protected]
    link
    fedilink
    431 year ago

    Python one is accurate. Most of our problems are solved by importing a library and writing the line, librarySolver.importedFunction.SolveMyProblem()

    def main(): Print(‘thanks librarySolver’)

    • @[email protected]
      link
      fedilink
      151 year ago

      Advent of code 2023 day 24 part 2. Z3 solver saved the day on that one.

      Now I have PTSD every time I see an hailstorm.

      • @[email protected]
        link
        fedilink
        6
        edit-2
        1 year ago

        So many solver solutions that day, either Z3 or Gauss-Jordan lol. I got a little obsessed about doing it without solvers or (god forbid) manually solving the system and eventually found a relatively simple way to find the intersection with just lines and planes:

        1. Translate all hailstones and their velocities to a reference frame in which one stone is stationary at 0,0,0 (origin).
        2. Take another arbitrary hailstone (A) and cross its (rereferenced) velocity and position vectors. This gives the normal vector of a plane containing the origin and the trajectory of A, both of which the thrown stone must intersect. So, the trajectory of the thrown stone lies in that plane somewhere.
        3. Take two more arbitrary hailstones B and C and find the points and times that they intersect the plane. The thrown stone must strike B and C at those points, so those points are coordinates on the line representing the thrown stone. The velocity of the thrown stone is calculated by dividing the displacement between the two points by the difference of the time points of the intersections.
        4. Use the velocity of the thrown stone and the time and position info the intersection of B or C to determine the position of the thrown stone at t = 0
        5. Translate that position and velocity back to the original reference frame.

        It’s a suboptimal solution in that it uses 4 hailstones instead of the theoretical minimum of 3, but was a lot easier to wrap my head around. Incidentally, it is not too hard to adapt the above algorithm to not need C (i.e., to use only 3 hailstones) by using line intersections. Such a solution is not much more complicated than what I gave and still has a simple geometric interpretation, but I’ll leave that as an exercise for the reader :)

        • @[email protected]
          link
          fedilink
          21 year ago

          That is a great explanation of how you solved it, thanks! I should go back to it and conquer that puzzle properly without a solver. Or at least try.