|
MALE SHOEGAZE posted:but what if I like, want to bind a function defined in my webpack entry to an onclick handler? add the handler to the element in javascript, instead of the handler to the element in html or use the output.library configuration to configure how you export your bundle, so you can reference it off of Window
|
# ? Mar 19, 2016 00:05 |
|
|
# ? Jun 11, 2024 19:47 |
|
got it. this explains so much. thank you.
|
# ? Mar 19, 2016 00:06 |
|
i'm assuming from you manually binding event handlers to html that this is a page mostly rendered on the backend right? that's a perfectly valid thing to do (and there should probably be more frameworks that are centered around that kind of thing), but would be weird if it's a front-end heavy page
|
# ? Mar 19, 2016 00:10 |
|
piratepilates posted:i'm assuming from you manually binding event handlers to html that this is a page mostly rendered on the backend right? yeah, mostly backend. I'm just using webpack to deal with transforming ES6 and jsx. I don't need any of the splitting or even the async loading (except for dependencies) because our total JS footprint is pretty tiny. i've just always hooked into my JS with an onload or something, so the idea of not importing anything into the document/window context is weird.
|
# ? Mar 19, 2016 01:05 |
|
yeah I tend to couple the script to the document by having some <div id="container"></div> and then calling document.getElementById("container") as a starting point
|
# ? Mar 19, 2016 02:41 |
|
I'm porting a Typescript React app back to Javascript this weekend. I actually wanted to do a massive refactoring/restructuring operation anyway and introduce Redux, but my main complain about Typescript is that it has not actually saved me from runtime errors on very many occasions. There's enough kludgery involving third party libraries, union types, and other things that I've found the Typescript compiler to be nothing but a hindrance and I still have to deal with enough runtime errors (the kind that a real statically typed language would not have to deal with) that I'd rather switch to ES6 and get the mainstream support. edit: If I had the resources to maintain perfect type definitions and do everything "right" it would probably be worth it. I don't though.
|
# ? Mar 19, 2016 13:45 |
|
fleshweasel posted:yeah I tend to couple the script to the document by having some <div id="container"></div> and then calling document.getElementById("container") as a starting point this is the correct way (and they way they show in all the tutorials) and they call it MOUNTING
|
# ? Mar 19, 2016 14:52 |
|
the more i read about webdev, the more glad i am that i don't have to deal with any of that poo poo at least the clown shows I use were designed by professional clowns with many years experience in the circus
|
# ? Mar 19, 2016 15:49 |
|
I have found third party definitions files mostly easy to set up, generally reliable in usage, and very helpful in improving the tooling. I really fear for you if you're gonna throw out typescript right before doing a big refactor. that's exactly when you would benefit from the type checking.
|
# ? Mar 19, 2016 16:42 |
|
i'm flying with es6 now and dang it's really really nice. honestly it's pretty decent scripting language. i could see using it over ruby or python. having JS's first class functions along with like...usable templating and finally a decent syntax for anonymous functions is pretty usable and fun.
|
# ? Mar 19, 2016 18:08 |
|
fleshweasel posted:I have found third party definitions files mostly easy to set up, generally reliable in usage, and very helpful in improving the tooling.
|
# ? Mar 19, 2016 18:42 |
|
yeah, what I'm trying to say is you might just have hosed up at doing it.
|
# ? Mar 19, 2016 20:51 |
|
I might try to learn Ceylon. Send help.
|
# ? Mar 19, 2016 22:29 |
|
i've been doing lots of rust lately. did you know there's a person on stack overflow who spends the majority of their time editing "rust" to "Rust" in everybody's posts? rust seems good tho
|
# ? Mar 19, 2016 22:45 |
|
gonadic io posted:Rust seems good tho yeah it's pretty good
|
# ? Mar 19, 2016 22:49 |
|
gonadic io posted:i've been doing lots of rust lately. did you know there's a person on stack overflow who spends the majority of their time editing "rust" to "Rust" in everybody's posts? Ice Cream Sandwich
|
# ? Mar 19, 2016 23:09 |
|
gonadic io posted:i've been doing lots of rust lately. did you know there's a person on stack overflow who spends the majority of their time editing "rust" to "Rust" in everybody's posts? yeah now the standard library is stabilising a bit and the 3rd party ones are sorting their poo poo out it's good
|
# ? Mar 20, 2016 08:21 |
|
fleshweasel posted:yeah, what I'm trying to say is you might just have hosed up at doing it. Don't get me wrong, I'm a huuuge proponent of static typing, and I look forward to dancing on JS's grave. But as far as I'm concerned, static typing needs to be pervasive (as opposed to optional) and have strong implications about runtime correctness in order to be truly useful to me. Typescript merely checks that its view of things is coherent according to its big list of axioms, but says nothing about whether it is correct. It takes extra effort to make sure that coherent and correct are the same thing (i.e. that Typescript's axioms actually reflect reality), and since I was dealing with most of the problems that JS brings anyway, the added cognitive burden just didn't seem worth it.
|
# ? Mar 21, 2016 01:57 |
|
anyone have an opinion on flow vs typescript or is it just the same poop from a different butt?
|
# ? Mar 21, 2016 12:17 |
|
Mahatma Goonsay posted:anyone have an opinion on flow vs typescript or is it just the same poop from a different butt? typescript is made by nerds on the c# team, flow is made by facebook's ocaml pl nerds. flow has a bit better type inference and nerdy types, typescript has some of it but is more traditional typing (like c#) people use typescript, for some reason almost no one uses flow typescript has a big community, flow has a tiny community flow has support for some es6 features, typescript has support for all of them + some es8 features (async/await) more or less different consistency poops from different butts
|
# ? Mar 21, 2016 14:03 |
|
uncurable mlady posted:scala seems like something with a couple of good ideas wrapped in a whole lot of bad ideas java will get a 'var' type thing sooner or later. (probably not in java 9 tho) the jep: http://openjdk.java.net/jeps/286 the 'bug' for the spec is actually better than the jep: https://bugs.openjdk.java.net/browse/JDK-8151454
|
# ? Mar 21, 2016 16:00 |
|
Mahatma Goonsay posted:anyone have an opinion on flow vs typescript or is it just the same poop from a different butt? typescript expected you to write javascript like it's c# or java. flow allowed much more idiomatic javascript by virtue of a better type system and type inference. flow never got a working windows version though and then typescript stole all of flow's good ideas. TS 2.0 (the next release) will support non-nullable types by default, which was the last major difference between them i guess also typescript has really good support in all major editors
|
# ? Mar 21, 2016 17:48 |
|
Notorious b.s.d. posted:java will get a 'var' type thing sooner or later. (probably not in java 9 tho) Haha why would they introduce both "var" and "val" instead of "var" and "final var"?
|
# ? Mar 21, 2016 22:34 |
|
"final var" makes mutability the shorter default option, so a lot of people will just use "var" even when they have no plans to assign a new value to the variable. making them the same length dramatically increases how many people will use the immutable version whenever possible
|
# ? Mar 21, 2016 22:58 |
|
So make your IDE automatically add "final" when you have a value that can use it? (Eclipse can already do this.) I'm just saying, why add two keywords when the "final" keyword is already sitting right there?
|
# ? Mar 21, 2016 23:10 |
|
Javascript got the dumbest version of a 'const' variable identifier keyword the 'const' identifier, which does not actually make the variable constant, just the binding of it constant: code:
|
# ? Mar 21, 2016 23:13 |
|
ya c# const is idiotic too it's just like java final except it doesn't force you to actually initialize the poo poo
|
# ? Mar 21, 2016 23:18 |
|
That "final" keyword is, admittedly, pretty worthless in Java. I see some people insist on putting it on all method parameters. I always want to ask what that's protecting against.
|
# ? Mar 21, 2016 23:19 |
|
Mr Dog posted:ya c# const is idiotic too what
|
# ? Mar 21, 2016 23:24 |
|
piratepilates posted:Javascript got the dumbest version of a 'const' variable identifier keyword boobs is constant here, but its value is the location of the object in memory. I don't really know C++ but I think it's like a const pointer? JavaScript code:
|
# ? Mar 21, 2016 23:37 |
|
CPColin posted:So make your IDE automatically add "final" when you have a value that can use it? (Eclipse can already do this.) because that's worthless. the value of the distinction is that it captures your intention. adding final automatically just captures the status quo at some arbitrary point in the process of typing in the code, which doesn't tell you anything about whether the variable is supposed to be mutable or not. and what's wrong with having two reserved type names instead of one? the proposal explicitly doesn't make them full keywords, so your variable called val isn't going to become illegal. and if you have an existing class called val then frankly you deserve everything you get.
|
# ? Mar 21, 2016 23:41 |
|
GrumpyDoctor posted:what const can be a null reference in c#, the only restriction is that the value of your const field or local has to be evaluated at compile-time
|
# ? Mar 21, 2016 23:43 |
|
uncurable mlady posted:const can be a null reference in c#, the only restriction is that the value of your const field or local has to be evaluated at compile-time how many times has that actually caused any problems in practice
|
# ? Mar 21, 2016 23:46 |
|
flow's documentation just seemed really flippant to me. like the fact that they didn't even mention how to run the language on windows and just had mac/linux instructions. gives off the vibe that facebook doesn't give a poo poo about anyone else's use case outside of facebook and so you shouldn't depend on it.
|
# ? Mar 22, 2016 00:15 |
|
Soricidus posted:because that's worthless. the value of the distinction is that it captures your intention. adding final automatically just captures the status quo at some arbitrary point in the process of typing in the code, which doesn't tell you anything about whether the variable is supposed to be mutable or not. So type "final" when you declare the variable? Of course, it's still going to be worthless anyway, because you can still probably mutate the poo poo out of whatever object you just declared. quote:and what's wrong with having two reserved type names instead of one? the proposal explicitly doesn't make them full keywords, so your variable called val isn't going to become illegal. and if you have an existing class called val then frankly you deserve everything you get. I dunno, I just figured the java designers usually have such a boner for reusing keywords, they might reuse one in this case.
|
# ? Mar 22, 2016 00:17 |
|
fleshweasel posted:flow's documentation just seemed really flippant to me. like the fact that they didn't even mention how to run the language on windows and just had mac/linux instructions. gives off the vibe that facebook doesn't give a poo poo about anyone else's use case outside of facebook and so you shouldn't depend on it.
|
# ? Mar 22, 2016 00:21 |
|
CPColin posted:So make your IDE automatically add "final" when you have a value that can use it? (Eclipse can already do this.) I'm just saying, why add two keywords when the "final" keyword is already sitting right there? I'm weary of this argument that you should just use IDE tooling to make up for the bad syntax of your language that causes users to do less safe/robust things by default. it's seriously not an excuse for having a bad language.
|
# ? Mar 22, 2016 00:21 |
|
Yeah if it were up to me then I'd change Java to (A) make byte unsigned and if I get a B then (B) make "final" the default state of affairs that you have to opt out of. But hey Java is used to develop serious applications that adults depend on to conduct business, so the stewards of the language don't just burn it all to the ground and start from scratch every five years except the bike shed is going to be pink instead of blue this time.
|
# ? Mar 22, 2016 00:24 |
|
I hope everybody understands I'm not defending Java's stupid "final" keyword. I agree that it's pointless most of the time. By extension, "val" would be, too. Ceylon seems to get it right (for modern values of "right"); immutable is the default and you have to annotate stuff with "variable" to make them behave otherwise.
|
# ? Mar 22, 2016 00:28 |
|
|
# ? Jun 11, 2024 19:47 |
|
is there a comprehensive overview of typescript that I'm missing? like http://www.typescriptlang.org/Handbook doesn't even tell you the syntax for a loving hash map (which is apparently { [key:string]:Type; })
|
# ? Mar 22, 2016 01:06 |