|
Space Whale posted:I finally had a reason to do more than glue some JS. I tried to overload a method. you can't overload methods in javascript unless you fake it with varargs though? or do you mean override cuz those aren't the same thing
|
# ? May 30, 2015 01:56 |
|
|
# ? Jun 5, 2024 11:25 |
|
javascript's object system is so bad
|
# ? May 30, 2015 01:57 |
|
Symbolic Butt posted:javascript's object system is so bad it's kinda appealing-despite-my-better-judgement if you don't call them objects and just call them associative arrays instead and also don't use prototype inheritance because otherwise you'll go mad trying to figure out what "this" means in any given context and then dehumanize yourself and face to closure hell. like doing single-threaded async io in javascript is probably legit easier than any other curly brace language as a result which is why node.js is a thing i suppose note that i'm not necessarily using "closure hell" perjoratively here
|
# ? May 30, 2015 02:00 |
|
the way I look at it is, method overloading depends on whether the types and number of parameters are part of the definition of the function javascript lets you call functions with as many or as few arguments as you want so there's no overloading like you would have in java or c#. you just need to handle the different sets of parameters you expect at the top of your function.
|
# ? May 30, 2015 02:23 |
|
Mr Dog posted:don't use prototype inheritance because otherwise you'll go mad trying to figure out what "this" means in any given context and then dehumanize yourself and face to closure hell. hmm? what's confusing about that? this is always the object on which the method was called, regardless of where in the prototype chain the method was found. this is how it works in classical inheritance as well, really: this doesn't change identity or dynamic type just because you're in an inherited method body.
|
# ? May 30, 2015 03:38 |
|
Subjunctive posted:hmm? what's confusing about that? this is always the object on which the method was called, regardless of where in the prototype chain the method was found. this is how it works in classical inheritance as well, really: this doesn't change identity or dynamic type just because you're in an inherited method body. no im pretty sure sometimes self is super and sometimes its not
|
# ? May 30, 2015 04:05 |
|
Snapchat A Titty posted:no im pretty sure sometimes self is super and sometimes its not you should file that bug, then. if that were the case then setting properties on this-cum-super would affect all instances, for starters. perhaps you're referring to the fact that this isn't captured by a closure, but it instead dynamically determined at invocation time (defaulting to the global object if it's called outside of a method-call expression)?
|
# ? May 30, 2015 04:15 |
|
Subjunctive posted:you should file that bug, then. if that were the case then setting properties on this-cum-super would affect all instances, for starters. soz im joking i meant to say i cant really imagine a situation where this/self does not refer to the instance currently executing the method. this is always this. if its not this, its gotta be some esolang where the closure moves step by step
|
# ? May 30, 2015 04:26 |
|
Subjunctive posted:hmm? what's confusing about that? this is always the object on which the method was called, regardless of where in the prototype chain the method was found. this is how it works in classical inheritance as well, really: this doesn't change identity or dynamic type just because you're in an inherited method body. except for call and apply and junk like that.
|
# ? May 30, 2015 06:31 |
|
|
# ? May 30, 2015 07:53 |
|
doug crockford is one of those fundamentalists who think the ++ operator is satan reincarnated
|
# ? May 30, 2015 08:06 |
|
i guess props for wearing a jacquet but also not for what looks like green or brown corduroys?
|
# ? May 30, 2015 08:11 |
|
he looks like an angry ridley scott emerging from a swamp
|
# ? May 30, 2015 08:12 |
|
I stopped writing javascript
|
# ? May 30, 2015 08:45 |
|
i saw some talk where he mentioned those points, but he never elaborated on them
|
# ? May 30, 2015 12:23 |
|
Suspicious Dish posted:doug crockford is one of those fundamentalists who think the ++ operator is satan reincarnated confronted by a vile and worldly creature like javascript, the ascetic approach is the reasonable choice with enough self-denial there might be a usable language under there somewhere
|
# ? May 30, 2015 15:19 |
|
Wheany posted:i saw some talk where he mentioned those points, but he never elaborated on them yeah, that was the exact moment that I realized how flaky Crockford is I mean, before that there was jslint and dec64 but I guess I'm just slow
|
# ? May 30, 2015 15:33 |
|
Suspicious Dish posted:doug crockford is one of those fundamentalists who think the ++ operator is satan reincarnated tbh using x++ or ++x as a function argument is pretty bad
|
# ? May 30, 2015 16:10 |
|
if ++ didn;t already exist and someone suggested it we'd all be mocking them mercilessly
|
# ? May 30, 2015 16:11 |
|
pointsofdata posted:if ++ didn;t already exist and someone suggested it we'd all be mocking them mercilessly nah one sight of while (*a++ = *b++); and we'd all realise how perfect an operator it is and add it to every language forever
|
# ? May 30, 2015 16:14 |
|
pointsofdata posted:if ++ didn;t already exist and someone suggested it we'd all be mocking them mercilessly idk, I might endorse the idea as a statement, but not as an expression. i kind also feel the same way about = and its friends.
|
# ? May 30, 2015 16:33 |
|
pointsofdata posted:if ++ didn;t already exist and someone suggested it we'd all be mocking them mercilessly http://blogs.msdn.com/b/oldnewthing/archive/2015/05/25/10616865.aspx
|
# ? May 30, 2015 16:38 |
|
wow that is stupid
|
# ? May 30, 2015 17:12 |
|
++ has side effects, is literally hitler
|
# ? May 30, 2015 17:25 |
|
An article like that is a two-edged sword, the visual studio team are dumb enough to implement retarded new ideas. So many comments.
|
# ? May 30, 2015 17:26 |
|
MrMoo posted:An article like that is a two-edged sword, the visual studio team are dumb enough to implement retarded new ideas. So many comments. it already exists everywhere
|
# ? May 30, 2015 17:39 |
|
shut up, let them keep springing the trap
|
# ? May 30, 2015 18:02 |
|
Notorious b.s.d. posted:with enough self-denial there might be a usable language under there somewhere true of every language I've used
|
# ? May 30, 2015 18:07 |
|
MrMoo posted:An article like that is a two-edged sword, the visual studio team are dumb enough to implement retarded new ideas. So many comments.
|
# ? May 30, 2015 18:30 |
|
MrMoo posted:An article like that is a two-edged sword, the visual studio team are dumb enough to implement retarded new ideas. So many comments.
|
# ? May 30, 2015 19:38 |
|
Wheany posted:i saw some talk where he mentioned those points, but he never elaborated on them i found a different talk looking for the first one and anyway this slide explains most of the points no this because an object's methods are all defined in a closure with its members so they don't need to use this no object.create or new or prototypes at all because every object is flat and has its own copy of every function in its inheritance chain i don't know what no null is about, i watched five minutes of this talk and thats enough, but since you can delete keys from objects anywhere youd need it i'd guess he probably just does that
|
# ? May 30, 2015 19:40 |
|
that is the worst outfit and facial hair i've seen in a while
|
# ? May 30, 2015 19:50 |
|
douglas crockford is kind of a clown but watching the talk helps you understand javascript if you didn't before I guess hopefully part of what you understand in the end is that prototypal inheritance sucks and if you must write javascript then just mash values into objects until you get the result you want passing around anonymous functions in javascript works nicely but it's basically the only thing about the language that works so you get callbacks inside callbacks inside callbacks endlessly to do anything he also came up with DEC64 lol http://dec64.com
|
# ? May 30, 2015 20:04 |
|
why does crockford like flat objects
|
# ? May 30, 2015 20:05 |
|
maybe because then you don't have to do hasOwnProperty?
|
# ? May 30, 2015 21:03 |
|
that's not a reason for liking flat objects. it's a reason for hating [the alternatives available in] javascript.
|
# ? May 30, 2015 23:01 |
|
closures are a poor man's objects and vice versa
|
# ? May 31, 2015 00:01 |
|
Lime posted:i found a different talk looking for the first one and anyway this slide explains most of the points the 'no null' thing is just being consistent in using undefined over null when you can. a bunch of libraries you use are gonna give you null so you can't really avoid it. this point doesn't really matter imo. the 'avoid falsiness' thing is to use the === operator almost always and avoid automatic coercion, preferably w/ some linting program. when you use the subset of javascript that crockford is advocating, javascript becomes a lot more like scheme. except it's statement-based instead of expression based which sucks. and it doesn't have sane metaprogramming. and uh it has a lack of a good set of number primitives. and it has a stupid notion of scope. and it doesn't support recursion as well. but yeah pretty similar.
|
# ? May 31, 2015 01:48 |
|
also dont take that as a defense of javascript javascript is truly a really garbage language and it's such garbage you should avoid most of its 'features' and use a very limited subset of it
|
# ? May 31, 2015 01:56 |
|
|
# ? Jun 5, 2024 11:25 |
|
Crystal seems like a nice language. I just can't believe they went through all the effort to make a better ruby and didn't remove 'unless'
|
# ? May 31, 2015 02:19 |