Yet another way to invoke functions without parentheses

(blog.ikaes.de)

123 points | by aragonite 2 days ago

9 comments

  • hans_castorp 2 hours 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 1 hour 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.’

      • bjoli 7 minutes ago
        There was a hilarious video in The early days of YouTube when someone tried to write Perl using vistas voice recognition.

        I haven't seen it in many many years, but at the time it struck my giggle button every time.

      • saghm 50 minutes ago
      • nullsanity 43 minutes ago
        I did genuinely try to run this since, well, it could be true, I don't know Perl.

        Bareword found where operator expected (Missing operator before "Ak"?) at -e line 1, near "&}Ak" Bad name after Ak' at -e line 1.

  • amelius 12 minutes ago
    I want to put the called function after the arguments:

        (((x)f)g)h
    
    So I can see exactly the order in which things happen, from left to right. As opposed to:

        f(g(h(x)))
    
    where I have to read backwards.
    • danlitt 4 minutes ago
      Do you mean (((x)h)g)f ?

      since the order in which things happen is "h first, then g, then f"

  • nathell 1 hour 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_.
    • bunderbunder 37 minutes ago
      I wonder if there was a period in the 90s where the chess community was more interested in talking about IBM’s stock price than in actually playing chess.
    • stymaar 49 minutes ago
      I'm definitely gonna use that for April 1st though, just adding this as instruction in Claude.md

      That will also serves as a litmus test to check how many of my coworkers are reading the code they push.

    • stigok 1 hour ago
      Programmers are still interested in code
      • cm2187 1 hour ago
        Weekend hobby!
        • mystifyingpoi 1 hour ago
          Now there is Monday again, no more coding, back to babysitting agents.
  • CrendKing 1 hour ago
    Not gonna work on Firefox, since according to the doc, Error.prepareStackTrace is an optional API and only implemented by V8.
    • fg137 1 hour ago
      > optional API and only implemented by V8

      aka "Chrome implemented this and wanted everyone else to do so as well"

  • pards 2 hours ago
    Off topic: This website looks like a ransom note
    • eviks 55 minutes ago
      Maybe it is, just requires a different parser
  • TheSilva 2 hours 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.
    • fg137 58 minutes ago
      The prototype thing is quite unique among mainstream languages. It is kind of simple in principle and works well for what it intends to do, but god it causes so much confusion and is frequently a source of CVEs. valueOf combined with implicit conversion is a nightmare for production code.
    • customguy 1 hour 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.
      • h43z 46 minutes ago
        Pretty interesting that you can carry comments over.

            (x=>/*this is a comment*/1) + 1
            "x=>/*this is a comment*/11"
        
        I wonder if anything cool can be done with it today. It's probably useless.
      • annex-winged-cr 38 minutes ago
        TIL about [^], never seen that before. Apparently, it works like a dot but it also matches newlines.
        • gmac 16 minutes ago
          Oh, me too. I’ve previously used [\s\S] for that.
  • semiquaver 2 hours ago
    JavaScript is so cursed.
    • user____name 1 hour 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 2 hours ago
    What's the purpose of the +x at the end?
    • undecidabot 2 hours ago
      The unary plus implicitly converts an expression to a number, which calls `valueOf` for non-primitive values.
    • emaro 2 hours ago
      I think to implicitly trigger the valueOf function.
  • CoalitionOfPity 2 hours ago
    [flagged]
    • user____name 1 hour ago
      GPT also thinks Frankenstein and Moby Dick are 100% AI last time I checked.
    • nathell 1 hour 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...’).
    • nmstoker 2 hours ago
      Aha, that's a great reassurance then! ;-)
    • LatencyKills 2 hours ago
      The irony of using AI to determine if something was written by AI.
      • happytoexplain 1 hour 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 1 hour 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 projects when, in fact, I didn't use AI at all. I've considered sharing some of my recent reverse engineering work on HN but am confident that it would devolve into "it must have been written by AI" bs.

          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. As someone who spent 22 years writing assembly and low-level C/C++, I think that's a shame. But that is the new reality.

      • mpweiher 2 hours ago
        'tsAll Goodman.
    • fzzzy 1 hour ago
      And it's wrong
    • brazukadev 1 hour ago
      Congratulations, you made a great thread worse.