Live data from Hacker News

A Javascript journey with only six characters

jazcash.com

51–60 of 123 posts

Re: A Javascript journey with only six characters

#51
post #42
post #41

Earlier quoted context omitted.

It does, see the "fill" step: «So now we have acquired the following extra characters: c,o,v,(,),{,[,],}, .».

Those characters are only inside a string, not as executable code.

Good catch. It seems that the "Object" string doesn't provide any crucial characters for further steps; in this case the literal curly brackets aren't needed.

Re: A Javascript journey with only six characters

#52

Does anyone know a good sandboxing technology to execute user written javascript in a safe way? (like, on other user machines or on the server)? I have some ideas like "learn programming" that would benefit from this immensely.

https://developers.google.com/caja/

Used it a few years ago. It was a little finnicky to get working right but I was impressed at the time. No idea where the project is at nowadays.

Re: A Javascript journey with only six characters

#53
post #40

Earlier quoted context omitted.

ES6 lets you define functions like a => a * 2 Or (a, b, c) => a * b ^ c

That's succinct, but less clear than the Ruby version, imo, as you don't have any scope indicators required for the function body. JS: let f = (a,b,c) => a * b ^ c; f(2,3,4); vs. Ruby: f = ->(a,b,c) { a * b ^ c } f.(2,3,4) Ruby's shorter and clearer. But, when you use the Ruby lambda more than once in the code, you lose the brevity advantage, because of the "extra" dot. But, in Ruby I use methods more than lambdas, w…

None is preventing you from writing let f = (a,b,c) => {a * b ^ c}; in JS

Re: A Javascript journey with only six characters

#54
post #53

Earlier quoted context omitted.

That's succinct, but less clear than the Ruby version, imo, as you don't have any scope indicators required for the function body. JS: let f = (a,b,c) => a * b ^ c; f(2,3,4); vs. Ruby: f = ->(a,b,c) { a * b ^ c } f.(2,3,4) Ruby's shorter and clearer. But, when you use the Ruby lambda more than once in the code, you lose the brevity advantage, because of the "extra" dot. But, in Ruby I use methods more than lambdas, w…

None is preventing you from writing let f = (a,b,c) => {a * b ^ c}; in JS

[deleted]

Re: A Javascript journey with only six characters

#56

Does anyone know a good sandboxing technology to execute user written javascript in a safe way? (like, on other user machines or on the server)? I have some ideas like "learn programming" that would benefit from this immensely.

What about Node.js's `vm` module?

Re: A Javascript journey with only six characters

#58
post #36

The article does not explain how it gets the {}, which is used to get the Object constructor string. Other than that it's very clear.

You're right. It's possible to use it later on but I've removed it as it doesn't make sense being at that point in the post chronologically. Thanks!

Re: A Javascript journey with only six characters

#59

Why do I feel like I have read this article a few years ago? I remember it, but it has 2016...

Because you did. I came to the comments wondering if this was a shameless ripoff of the original or a re-post from the same author.

If it's similar to another article, I'd love to see it. I wrote this over the last two days using only the sources noted at the bottom of the post.

Re: A Javascript journey with only six characters

#60

It's too bad that people were willing to ostracize Brendan Eich for not being a cookie-cutter silly-valley progressive. Oculus is facing that now. It's the new mccarthyism.

Well, that's hardly true. I thought we'd established that JS in inferior to Lisp. ;-)

You forgot this: (
Post reply on HN