last day (27 days later) » 

!!> function() {} + new Date + [] + {} + 3 + "banana" + NaN
 
@copy "SyntaxError: function statement requires a name"
 
11:13 PM
!!> (function() {}) + new Date + [] + {} + 3 + "banana" + NaN
 
@Shmiddty "function () {}Tue Jan 21 2014 18:13:05 GMT-0500 (Eastern Standard Time)[object Object]3bananaNaN"
 
hm
looks left
looks right
yes, this is the room for that.
For elaborate bashing of weak type coercion, quirks, lack of operator overloading and homogenous arrays
so here's a Wat video for a good start
 
user406009
Arrays in javascript are homogenous?
 
!!> cooljoin = [1,2,3].join; cooljoin(" ");
 
@copy ""
 
11:21 PM
Wait, not even an Error?
 
@Lalaland try [1, potato, { }]
!!> [1, "potato", { }]
 
@BartekBanachewicz "ReferenceError: potato is not defined"
 
oh right
 
@BartekBanachewicz [1,"potato",{}]
 
that's such an useful value I got here
in Lua it would just be an untyped object with implicit numeric keys
@Lalaland like, that "lack of" extends to the end
 
11:35 PM
!!> atob = 5; console.log(atob); delete atob; console.log(atob);
 
@copy "undefined" Logged: 5,"function atob() {\n [native code]\n}"
 
@copy what the hell
i mean, that's touching object destruction
which is kinda moot in GCed languages, no?
 
@BartekBanachewicz yes, he is doing all sorts of things you don't really do.
@Lalaland you may create arrays that are and it'll know to optimize them and make them faster because of it, but you may create heterogeneous arrays as well.
 
11:50 PM
@BenjaminGruenbaum we've been over that before. These lines illustrate examples that might appear in larger code
room topic changed to Is JavaScript Bad?: Discussion on the JavaScript language and whether or not it is inherently a bad language. [danymic-typing] [quirks,] [weak-coercion,]
room topic changed to Is JavaScript Bad?: Discussion on the JavaScript language and whether or not it is inherently a bad language. [danymic-typing] [quirks] [weak-coercion]
 
@BartekBanachewicz delete is moot, that's like calling free in the middle of code instead of doing RAII in C++ or implementing a destructor in C# over a managed resource, or implementing __del__ for no good reason in Python.
 
@BenjaminGruenbaum i agree on that one particular thing
heterogenous arrays, on the other hand...
I have spent a lot of thought on them
I've skimmed through basic stuff like polymorphism
and eventually got into the scenario of "create object, put it into array, then add the required property to it"
 
Oh, I didn't even think we were talking about C++ like value semantics for arrays where you can't have proper polymorphism
Those are usually horrible, but again - completely avoided.
 
@BenjaminGruenbaum ekhm, std::ref_wrapper
 
Like I said - completely avoided...
 
11:54 PM
@BenjaminGruenbaum wait what is avoided again?
 
keep away from
 
@BartekBanachewicz value semantics for arrays where you want polymorphism.
 
@copy you're so funny :3
@BenjaminGruenbaum why?
 
@BartekBanachewicz you're asking why it's easy to avoid that in C++?
 
I'm confused
why are we talking about C++
my point was that there's no reason in creating a collection of objects if they aren't a collection bound by some common trait
 
11:57 PM
Their common trait is that they're members of the collection.
 
@BenjaminGruenbaum you eventually have to do something on all of them
otherwise you wouldn't need a collection
the requirement for "something" is the trait
 
Oh, you mean it like that - then sure.
 
as I said, I gave it a bit of thought and it becomes a problem when you have multiple traits
 
@BenjaminGruenbaum then essentially you might have a bag of things, and views of those bag that filter the elements based on traits
 
11:59 PM
@BartekBanachewicz sure, I don't see how that's an issue or problem with JS.
 

  last day (27 days later) »