Live data from Hacker News

A Javascript journey with only six characters

jazcash.com

71–80 of 123 posts

Re: A Javascript journey with only six characters

#71
post #63

I don't see the point of a programming language allowing itself braining fucking its users(developer) for serious use

All those idiosyncratic moments were taken into Javascript right from Perl. Perl can do this and much more.

And Perl codebase is huge. Perl is used quite heavily at Amazon, Booking.com and Yahoo, among others.

Say what you want about Perl, but it is fun and hacker-friendly. I enjoyed it for many years.

Re: A Javascript journey with only six characters

#73
post #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.

i saw caja, but it looks really complex, was hoping for something better these days :(

Re: A Javascript journey with only six characters

#75

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?

thanks, I didn't actually know about that. it looks like a perfect (and simple) solution for running on nodejs. wish there was something like that for browsers too!

edit: i guess there is this: https://github.com/substack/vm-browserify

Re: A Javascript journey with only six characters

#76
post #67
post #53

Earlier quoted context omitted.

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

when you include curly braces in arrow functions you lose the implicit return, so this function would return undefined

You can get the implicit return if you use parentheses instead:

f = (a,b,c) => (a * b ^ c)

Re: A Javascript journey with only six characters

#77
post #32

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.

For what it's worth, Brendan Eich is a joke for technical reasons as well, like creating JavaScript.

Well that escalated quickly.

Re: A Javascript journey with only six characters

#78

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.

This feels like basically the reverse of the ad hominem, where if you agree with the things someone is saying in a particular context, you also have to praise them as a person. And it's a fallacy for the same reason the ad hominem is a fallacy. I can respect Brendan Eich's technical views without having to respect his political / social ones, and I can believe that he's amazingly qualified to be CTO of Mozilla, a technical role, and yet amazingly unsuited to be CEO, a political/social role. And this isn't just me - none of the controversy started until he moved from CTO to CEO.

If we can't do that, then we ostracize people who aren't a cookie-cutter $political_view.

Re: A Javascript journey with only six characters

#79

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.

The safest way would be to embed an interpreter written in JS and remove any sort of I/O or FFI capability from the interpreter.

Re: A Javascript journey with only six characters

#80
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…

the ruby versions isnt shorter though; you just included things you dont need: semi colons and 'let'
Post reply on HN