logoalt Hacker News

Yet another way to invoke functions without parentheses

207 points • by aragonite • last Tuesday at 7:25 PM • 91 comments • view on HN

Comments

hans_castorp • today at 11:03 AM

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);
➕ show 1 reply
nathell • today at 11:12 AM

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_.

➕ show 1 reply
amelius • today at 12:55 PM

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.
➕ show 16 replies
MattCruikshank • today at 2:08 PM

I want to write a super pedantic book showing every way I can think of to move data from here, to there. In the same program, or between programs.

Global variable.

Parameter to a function.

Pass a functor/lambda, get the value.

Environment variable.

Registry.

File.

Store it in a ping response.

VRAM texture that you write and then read.

Database.

REST server.

I'm pretty sure I could come up with a thousand ways.

But... why? Why do I want to write this book? Why has it been on my mind?

➕ show 4 replies
pards • today at 10:50 AM

Off topic: This website looks like a ransom note

➕ show 1 reply
CrendKing • today at 11:31 AM

Not gonna work on Firefox, since according to the doc, Error.prepareStackTrace is an optional API and only implemented by V8.

➕ show 1 reply
TheSilva • today at 10:41 AM

  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.
➕ show 2 replies
semiquaver • today at 10:42 AM

JavaScript is so cursed.

➕ show 1 reply
CreepyHunterX • today at 3:39 PM

This is a creative hack, and here’s where it actually matters. Blocklist-based sanitizers and WAFs typically work by matching a string or a regex, so this type of hack usually slips past them. I found this class of XSS in audits in telemetry fields that were protected by a regex blocklist. The actual fix was not just a longer blocklist, but context-aware output encoding (plus a CSP as defense in depth).

shevy-java • today at 3:12 PM

It is called ... Ruby.

(Though, parentheses are sometimes needed due to ambiguity. But by and large, the lispy legacy has been overcome already.)

aktenlage • today at 10:45 AM

What's the purpose of the +x at the end?

➕ show 2 replies
CoalitionOfPity • today at 10:54 AM

[flagged]

➕ show 7 replies