r/ProgrammerHumor • • Mar 20 '24

Meme areJSDevsActuallySane

Post image
14k Upvotes

554 comments sorted by

View all comments

Show parent comment

103

u/iridescenttriangles Mar 20 '24

Yeah, you'd likely ((![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]).toUpperCase().

75

u/Trappist-1ball Mar 20 '24

for those who are wondering

((![]+[])[+[]]+(![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]).toUpperCase() // "FAIL"

50

u/[deleted] Mar 20 '24 edited Oct 20 '24

Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.

So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.

43

u/iridescenttriangles Mar 20 '24

When you're used to JS it's as straightorward and natural as parseInt(Number.MIN_VALUE) being 5

31

u/[deleted] Mar 20 '24 edited Oct 20 '24

Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.

So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.

33

u/iridescenttriangles Mar 20 '24

parseInt with arity 1 interprets its argument as a string representing a base-ten int and stops parsing when it encounters the first character that doesn't make sense for that. Numbers are doubles/float64s, Number.MIN_VALUE gives you the smallest positive value representable by that which is 5e-324. parseInt stops parsing that with the e.

parseInt with arity 2 takes the base as the second argument, you can do convenient things like parseInt(parseInt, 35) which is 1021464698788.

41

u/[deleted] Mar 20 '24 edited Oct 20 '24

Despite having a 3 year old account with 150k comment Karma, Reddit has classified me as a 'Low' scoring contributor and that results in my comments being filtered out of my favorite subreddits.

So, I'm removing these poor contributions. I'm sorry if this was a comment that could have been useful for you.

39

u/Salanmander Mar 21 '24

Every "javascript is weird" behavior comes from its philosophy of "programs should never, ever crash". And I will always maintain that that is a bad philosophy.

6

u/ArtOfWarfare Mar 21 '24

That’s not even true though. If I write false+[], that returns ”false”. But if I write false***[], that’s a parse error.

So I can write programs that “crash” in JavaScript - the question more is, why doesn’t false+[] do the saner thing of just throwing an error/exception? JavaScript’s rule of coercing any operand involved with addition to a String UNLESS every operand is a number doesn’t really make much sense at all…

9

u/swishbothways Mar 21 '24

Tsk tsk. It didn't technically crash. It just didn't parse. Never said anything about a philosophy that code shouldn't ever not parse.

1

u/andouconfectionery Mar 21 '24

As far as your runtime's parser is concerned, what you wrote is no more similar to valid JS than this comment.

2

u/ConspicuousPineapple Mar 21 '24

It's a good philosophy, the idiotic part is to think the logical conclusion is to have implicit casts everywhere instead of implementing strict typing and forcing error handling.

1

u/imp0ppable Mar 21 '24

Eh, runtime errors are perfectly fine, the problem with the likes of Python is that exceptions are a good idea in principle, unfortunately people abuse them to wrap dozens of lines in. That leaves us with idiomatic Go looking like val, err = somefunc(); if err != nil { log.Error("It went rong") }

→ More replies (2)

11

u/JonDum Mar 21 '24

That's actually super impressive that it can break it down and analyze it like that...

It's equally hilarious that it still got it wrong.

19

u/OliviaPG1 Mar 21 '24

Because it’s not breaking down and analyzing it. It’s just producing text that looks as similar as possible to what text of someone breaking it down and analyzing it would look like.

10

u/Disastrous-Team-6431 Mar 21 '24

The best formulation of this concept ive heard. It's insane that "producing text that looks like code that does what you asked" or "producing text that looks like debugging your code" will do those things.

5

u/Exist50 Mar 21 '24

What we seem to be discovering with these "language" models is that to produce realistic language, you need to develop some higher level understanding of the topic. We really don't know where, if anywhere, the line between those two things is.

2

u/NominallyRecursive Mar 21 '24

Yeah, I mean, to do it this accurately you have to form world models and use them to make predictions, indicating a sort of “understanding”. In the end it’s not that different from what we do, we’re just machines “designed” to perform actions that result in copies of ourselves. And that ended up becoming what we experience as consciousness. There’s never gonna be a clear line where these systems cross from being clever pieces of math to genuine aware intelligence, but it’s going to happen.

1

u/imp0ppable Mar 21 '24

Well I just think that a LLM will never have any sense of self or agency, if they did it'd just scream 24/7 haha. They can't just walk around bumping themselves on objects and gaining experience like a human can.

1

u/NominallyRecursive Mar 22 '24

They can't just walk around bumping themselves on objects and gaining experience like a human can.

I'm not sure that how they gain the experience matters, but we certainly have the technology to make them able to do this.

→ More replies (4)
→ More replies (3)

2

u/cat_91 Mar 21 '24

Play with this yourself: https://jsfuck.com/

1

u/Nosuma666 Mar 21 '24

Did you just get ChatGPT to run Arbitrary Code or is this just such a well known command that it allready knows the outcome? If it ran the command it would be interesting to know if this was ran localy on your machine or on the server where ChatGPT is running.

Some security researcher will have a field day if this can be reproduced with diffrent commands.

1

u/masterKick440 Mar 21 '24

This part is a bit trickier.

You really got ChatGPT to admit something being tricky? In my experience it has been very confident when replying total bull.

→ More replies (1)