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.
A Javascript journey with only six characters
61–70 of 123 posts
Re: A Javascript journey with only six characters
#62This is an extreme demonstration of the validity of a delightfully snarky blog post by Robert Harper on how dynamic typing is actually static typing using a unitype: https://existentialtype.wordpress.com/2011/03/19/dynamic-lan... A string is a Boolean is a number is a function, and braindead conversions can happen without anyone noticing. How does one keep their sanity using a language like that?
What the OP takes to the extreme is a property of weak typing, not dynamic typing. These properties are separate issues. A language is either statically typed or dynamically typed, and it is also either strongly typed or weakly typed. In a statically typed language, types are attached to variables. In a dynamically typed language, types are attached to values. Do note that many languages don't fit 100% into either ca…
Re: A Javascript journey with only six characters
#63Re: A Javascript journey with only six characters
#64Re: A Javascript journey with only six characters
#65Why do I feel like I have read this article a few years ago? I remember it, but it has 2016...
Re: A Javascript journey with only six characters
#66This doesn't make me want to use JS. The power of JS is in two things, it's in every major browser and it doesn't completely suck. JS syntax kind of sucks. The power in JS is that it's dynamic and lets you send functions around, but defining functions is much uglier than defining a lambda in Ruby: -> {anything goes here} or ->(a,b,c) {anything goes here} The problem with Ruby is that you then have to .() the lambda v…
Re: A Javascript journey with only six characters
#67Earlier 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
Re: A Javascript journey with only six characters
#68Re: A Javascript journey with only six characters
#69Re: A Javascript journey with only six characters
#70Earlier quoted context omitted.
this would obviously be a fun thing to do, but I wonder how much larger the code will get via this means of obfuscating. Maybe space isn't a concern in your use case though...
I imagine it could be largely mitigated by compression
only worth it for long enough code, but then the browser is having a lot of trouble parsing the obfuscated version...
Still: "The js code of this page has been encoded (see source). Compression reduced it from 288k to 37k characters."