|
Condiv posted:What? When I define a function, I want it to react pretty predictably to inputs given. I'd rather not allow for a whole new set of errors to be allowed by having "this" resolve to whatever the function happens to have been assigned to at the moment. so don't use "this" or use _.bind on your function.
|
# ? Jul 12, 2012 01:28 |
|
|
# ? Jun 13, 2024 05:36 |
|
you would have already known to do that if you knew anything at all about javascript
|
# ? Jul 12, 2012 01:29 |
|
Condiv posted:What? When I define a function, I want it to react pretty predictably to inputs given. I'd rather not allow for a whole new set of errors to be allowed by having "this" resolve to whatever the function happens to have been assigned to at the moment. a function in javascript is an object, just like "a string", the number 5, or a hash table you can store functions in anything that accepts an object, such as arrays or hash tables h.f(arg) is simply syntactic sugar for h['f'].call(h, arg) code:
if you don't want that, exploit that js functions are closures and bind "this" in: code:
code:
in conclusion, quit pretending js isn't a dynamic language
|
# ? Jul 12, 2012 01:32 |
|
Tiny Bug Child posted:so don't use "this" or use _.bind on your function. Yep, use more libraries to paper over the flaws in the language. That or ignore it. Tiny Bug Child posted:you would have already known to do that if you knew anything at all about javascript Actually, nowadays I just use private members in classes with getter and setter functions when I need them. quote:if you don't want that, exploit that js functions are closures and bind "this" in "this" should be bound by default considering js functions are closures. Condiv fucked around with this message at 01:43 on Jul 12, 2012 |
# ? Jul 12, 2012 01:35 |
|
if someone doesn't see why that's a thing about javascript that rules, dropping a whole bunch of words on they dumb rear end won't help. bet you he wishes js had classical inheritance too
|
# ? Jul 12, 2012 01:36 |
|
Tiny Bug Child posted:if someone doesn't see why that's a thing about javascript that rules, dropping a whole bunch of words on they dumb rear end won't help. bet you he wishes js had classical inheritance too you can add it
|
# ? Jul 12, 2012 01:37 |
|
Condiv posted:Yep, use more libraries to paper over the flaws in the language. That or ignore it. lolll
|
# ? Jul 12, 2012 01:37 |
|
this gosh darn language is just too flexible and expressive. let me mangle it until it looks like java
|
# ? Jul 12, 2012 01:39 |
|
i'll bet he's hand-writing accessors instead of having written a function to write themcode:
|
# ? Jul 12, 2012 01:44 |
|
yaoi prophet posted:
is there anything special about the value 86400, other than it being sqrt(2) minutes? i feel like i've seen it elsewhere
|
# ? Jul 12, 2012 01:48 |
|
Zizzyx posted:is there anything special about the value 86400, other than it being sqrt(2) minutes? i feel like i've seen it elsewhere 60 * 60 * 24 // => 86400
|
# ? Jul 12, 2012 01:49 |
|
never mind that setTimeout takes ms and not s https://developer.mozilla.org/en/window.setTimeout
|
# ? Jul 12, 2012 01:49 |
|
smoke weed 1000 times a day also smh if you don't know the number of seconds and minutes in a day by heart
|
# ? Jul 12, 2012 01:51 |
|
yaoi prophet posted:smoke weed 1000 times a day i don't, why should i when multiplication is cheap and "1000 * 60 * 60 * 24" makes it obvious what i mean
|
# ? Jul 12, 2012 01:52 |
|
yaoi prophet posted:smoke weed 1000 times a day I bet you're memory would have failed you on June 30 and Dec 31
|
# ? Jul 12, 2012 01:58 |
|
because you might see it in other places that aren't source code
|
# ? Jul 12, 2012 01:58 |
|
BonzoESC posted:i'll bet he's hand-writing accessors instead of having written a function to write them That code creates or modifies public members, which kinda defeats the purpose of a getter/setter method doesn't it?
|
# ? Jul 12, 2012 02:00 |
|
Condiv posted:That code creates or modifies public members, which kinda defeats the purpose of a getter/setter method doesn't it? does javascript have "private members?" what's the point of private members in a language that lets you add methods to an object?
|
# ? Jul 12, 2012 02:08 |
|
BonzoESC posted:i don't, why should i when multiplication is cheap and "1000 * 60 * 60 * 24" makes it obvious what i mean cause php:<? class butt { const SECONDS_PER_DAY = 1000 * 60 * 60 * 24; } ?>
|
# ? Jul 12, 2012 02:08 |
|
Condiv posted:Yep, use more libraries to paper over the flaws in the language. That or ignore it. LOFL this whole post
|
# ? Jul 12, 2012 02:09 |
|
Tiny Bug Child posted:cause LOFL this whole post
|
# ? Jul 12, 2012 02:13 |
|
wow looks like it's javascript ftl after all
|
# ? Jul 12, 2012 02:15 |
|
BonzoESC posted:does javascript have "private members?" code:
Condiv fucked around with this message at 02:19 on Jul 12, 2012 |
# ? Jul 12, 2012 02:16 |
|
weird how lua doesn't have that strange problem with "this"
|
# ? Jul 12, 2012 02:16 |
|
Condiv posted:[code] so write tests compiler's not gonna save you here
|
# ? Jul 12, 2012 02:21 |
|
ahhh spiders posted:weird how lua doesn't have that strange problem with "this" of the two languages that live in web browsers, js is so much better than vbscript it's not even funny
|
# ? Jul 12, 2012 02:22 |
|
BonzoESC posted:of the two languages that live in web browsers, js is so much better than vbscript it's not even funny vbscript is the best thing because you know anyone who ever lists it on their resume is terrible
|
# ? Jul 12, 2012 02:24 |
|
BonzoESC posted:of the two languages that live in web browsers, js is so much better than vbscript it's not even funny would b cool if browsers ran lua
|
# ? Jul 12, 2012 02:25 |
|
browsers should only accept C if you can't handle it get off the web
|
# ? Jul 12, 2012 02:28 |
|
BonzoESC posted:so write tests I meant by using encapsulation.
|
# ? Jul 12, 2012 02:32 |
|
ahhh spiders posted:would b cool if browsers ran lua totes
|
# ? Jul 12, 2012 02:32 |
|
Tiny Bug Child posted:cause well that's just because php sucks, in any language worth poo poo that has a const k/w it can still evaluate an expression on first assignment. If thats a parse error that gives some insight into how poorly the php grammar is constructed.
|
# ? Jul 12, 2012 02:33 |
|
Condiv posted:I meant by using encapsulation. it's not a magick wand that makes your code "stable and functional", it's just a way to make it more inconvenient to write if you want to know that your programs work, define what "work" means by writing tests, and have the tests run on all your code
|
# ? Jul 12, 2012 02:34 |
|
BonzoESC posted:it's not a magick wand that makes your code "stable and functional", it's just a way to make it more inconvenient to write Of course encapsulation doesn't solve stability problems, it just makes them easier to manage. I don't agree that it makes code more inconvenient though. Oh and I know about unit testing. quote:would b cool if browsers ran lua Condiv fucked around with this message at 02:46 on Jul 12, 2012 |
# ? Jul 12, 2012 02:44 |
|
javascript is pretty cool, i enjoy it for the most part thank you
|
# ? Jul 12, 2012 02:46 |
|
javascript is fine if youre not a keyboard cowboy
|
# ? Jul 12, 2012 02:51 |
|
css is the worst
|
# ? Jul 12, 2012 02:55 |
|
yes it rly is
|
# ? Jul 12, 2012 02:58 |
|
Sweeper posted:css is the worst trex eaterofcadrs posted:javascript is fine if youre not a keyboard cowboy Yeah, it's ok. Just some things about it bug me ("this", silent failures).
|
# ? Jul 12, 2012 03:00 |
|
|
# ? Jun 13, 2024 05:36 |
|
Sweeper posted:css is the worst https://www.youtube.com/watch?v=UXjUQnSi9zE
|
# ? Jul 12, 2012 03:02 |