Yet another way to invoke functions without parentheses

(blog.ikaes.de)

62 points | by aragonite 2 days ago

8 comments

  • hans_castorp 34 minutes ago
    This reminds me of "Creators admit Unix, C hoax" (e.g. https://www.gnu.org/fun/jokes/unix-hoax.html)

    > We stopped when we got a clean compile on the following syntax:

        for(;P("\n"),R--;P("|"))for(e=C;e--;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);
    • nathell 7 minutes ago
      How Perl was created:

      ‘Larry, throw the cat at the keyboard!’

      MEEEOW!

      ‘What did it type?’

      ‘&}Ak'>v=4%Qe}9;’

      ‘OK, so let’s make this a syntax for hello world.’

  • TheSilva 56 minutes ago

      Object.prototype.message='alert\x281337\x29';Array.prototype.toString=Error.prototype.toString;Error.prepareStackTrace = Function;const x = new Error;x.valueOf=x.stack;+x;
    
    Well, that's a mouthful! So many years and JavaScript still can do the most amazing, weird, awesome, scary, obscure, and sexy things in the world of coding.
    • customguy 4 minutes ago
      Yesterday I was re-using some shaders I had written a long time ago, and here's what I used to do multiline strings before the glorious backtick arrived on the scene...

          (function () {/*
            my awesome shader code
          */}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]
      
      ... I can't call it sexy, but I also can't deny I felt a mixture of fear and arousal when I saw that.
  • CrendKing 6 minutes ago
    Not gonna work on Firefox, since according to the doc, Error.prepareStackTrace is an optional API and only implemented by V8.
  • nathell 25 minutes ago
    I love this. This is a fun hack, but the article also hearkens back to pre-LLM days when people were still interested in _code_.
  • pards 47 minutes ago
    Off topic: This website looks like a ransom note
  • semiquaver 56 minutes ago
    JavaScript is so cursed.
    • user____name 16 minutes ago
      If I were to write a book on programming in JS, it would be a black cover with the JS Holy Trinity equality diagram in red, to emphasize its Satanic nature.
  • aktenlage 52 minutes ago
    What's the purpose of the +x at the end?
    • undecidabot 40 minutes ago
      The unary plus implicitly converts an expression to a number, which calls `valueOf` for non-primitive values.
    • emaro 48 minutes ago
      I think to implicitly trigger the valueOf function.
  • CoalitionOfPity 43 minutes ago
    GPTzero says this entire thing is AI generated for those concerned.
    • user____name 15 minutes ago
      GPT also thinks Frankenstein and Moby Dick are 100% AI last time I checked.
    • brazukadev 0 minutes ago
      Congratulations, you made a great thread worse.
    • nathell 23 minutes ago
      Doesn’t feel LLM-y to me. If it is LLM-generated, the LLM must have been explicitly instructed to ignore sentence capitalization and invent a persona (‘i chose...’).
    • fzzzy 15 minutes ago
      And it's wrong
    • nmstoker 36 minutes ago
      Aha, that's a great reassurance then! ;-)
    • LatencyKills 37 minutes ago
      The irony of using AI to determine if something was written by AI.
      • happytoexplain 14 minutes ago
        Ironic in a good way, you mean? Like employing a counterfeiter to help identify counterfeits?

        Regardless, I don't think it's correct on this one.

        • LatencyKills 0 minutes ago
          I'm not pro-AI (at least not the way the SOTA model companies operate) but I'm tired of seeing "written by AI" on every single thing on HN.

          I get "wRiTteN bY aI!" comments on my open source project when, in fact, I didn't use AI at all.

          Is it important to know if something was created with AI? Yes. But spewing "written by AI!" without reading/evaluating something yourself is just as lazy.

          The new generation of engineers will never know a world where all software was written by humans.

      • mpweiher 31 minutes ago
        'tsAll Goodman.