News for hackers. Stuff that matters.
Re:JavaScript is Good, Actually by rusk on Wednesday May 16, 2018 @04:23AM (#17080801)
You still need to make `ObjectStream os = new ObjectInputStream(new FileInputStream(filename))); MyObject mo = (MyObject) os.readObject();` which is the most basic form I can think of (you've got to put in all them bloody `try/catches` as well don't forget, along with `public class MyClass { public static void main(String[] args) { ...` etc. etc.).

Whereas javascript you can just go `require(myjsonfile)`

I love java, but Javascript is indeed great for some of these kinds of things :-)

Re:JavaScript is Good, Actually by cpburns2009 on Wednesday May 16, 2018 @12:14PM (#17083551)
> Whereas javascript you can just go `require(myjsonfile)`

I'm not current on Node features, but that looks dangerous to do. Is that equivalent to reading the file and `eval()`ing it?

Re:JavaScript is Good, Actually by kbp on Wednesday May 16, 2018 @04:25PM (#17086134)
> I'm not current on Node features, but that looks dangerous to do. Is that equivalent to reading the file and `eval()`ing it?

No:

    > const fs = require('fs')
    undefined
    > fs.writeFileSync('file.js', 'console.log("yes")'); require('./file')
    yes
    {}
    > fs.writeFileSync('file.json', 'console.log("no")'); require('./file.json')
    SyntaxError: file.json: Unexpected token c in JSON at position 0
Re:JavaScript is Good, Actually by gaius on Wednesday May 16, 2018 @05:16PM (#17086570)
This is the community that installs things by curl|sudo bash, remember