|
no, I have source maps enabled. but source maps are extremely fragile, and they don't seem to work for breakpoint debugging (local variable names are still mangled, sometimes chrome just shows me the unmapped .js file anyway). error stacks as well seem to be completely untranslated through source maps. and how do i import modules through the JS console REPL? it's weird because we solved debuginfo years ago with DWARF but somehow the web guys decided to throw all of it out the reinvent it with some quirky JSON garbage, and they can't even do that right
|
# ? Dec 12, 2018 18:49 |
|
|
# ? Jun 3, 2024 22:11 |
|
Dumb Lowtax posted:A good estimation of how long typescript takes to setup
|
# ? Dec 12, 2018 18:55 |
|
Suspicious Dish posted:no, I have source maps enabled. but source maps are extremely fragile, and they don't seem to work for breakpoint debugging (local variable names are still mangled, sometimes chrome just shows me the unmapped .js file anyway). error stacks as well seem to be completely untranslated through source maps. and how do i import modules through the JS console REPL? i've definitely gotten breakpoint debugging to work with source maps before, it's not an intrinsically impossible thing.
|
# ? Dec 13, 2018 02:42 |
|
Lumpy posted:What is "estimating"? Is that when you first hear the arbitrary deadline imposed on you? Because even just getting the tooling all set up correctly, if you can do typescript just fine already, will likely take you more than three days, unless you already happen to use an overcomplicated set of tooling that can trivially flip over from javascript to typescript.
|
# ? Dec 13, 2018 05:57 |
|
Parcel is definitely the least bad of the bundlers, and it still has a bunch of obviously lovely design decisions, like how raw file text inclusion requires this bizarre thing with fake API calls that get text replaced at parse time.
|
# ? Dec 13, 2018 06:14 |
|
roomforthetuna posted:I was saying you are correct in estimating "don't think learning typescript and getting the tooling all set up will fit in [three days]". Ahh. Gotcha. I *want* to use typescript (actually I want to use Elm, but...) but in a fairly sized codebase with crazy deadlines I don’t see the daylight to work it in there. To be fair, I started a small personal project a few months ago and was hell bent on using typescript: I made it about two hours in and was reading about typing my redux action when I deleted it and started over with plain old JS. Maybe my New Years resolution will be to actually do something with it. Is there a React / Redux focused resource you guys would recommend? Having written some stuff in Elm, I see the benefit, but I can’t stop listening to the voice that says “you’d be done by now if you just used vanilla....”
|
# ? Dec 13, 2018 15:14 |
|
Bruegels Fuckbooks posted:i've definitely gotten breakpoint debugging to work with source maps before, it's not an intrinsically impossible thing. i've seen it working before, once. it's not impossible but it's really brittle and nobody seems to care to invest any time into fixing it.
|
# ? Dec 13, 2018 21:43 |
|
I mostly do my debugging with console.log these days, to be honest.
|
# ? Dec 13, 2018 21:47 |
|
I think my issue with Typescript is just that ES2015+ is really really good. It does whatever I need without types when I write my code cleanly. More than that, I spend a lot of my time in Node, which immediately means Typescript is not nearly so useful to me. I do not want to compile my code if I don't have to and in Node my code is always going to run the same way. When I transition to the client side, I have very little reason to context switch my programming language. That's probably the biggest reason Node took off in popularity, because people didn't want to write in two languages. The least important reason I don't want to use Typescript is because combining it with god knows what you really need, like Vue or a any number of front end technologies is more difficult than not doing it. The pain points aren't worth it unless I'm writing something exceedingly complicated. I'd rather just write explicit code across a large number of different files anyway.
|
# ? Dec 13, 2018 21:56 |
|
Anyone have any experience calling native code from Electron? I've been fiddling with it recently and I can't help but feel like I'm fighting the system somehow. I have a dll/.so/dylib that has been convenient built by someone else, and I wanted to call a couple of functions in it. I started out with ffi, and quickly wrapped the dll up on Windows. Moved over to a Mac and found that ffi hasn't been maintained since 2016, and no longer works with anything newer than Node 8. I tried replacing ffi with ffi-napi, which seemed to work with Node 10, but I couldn't get it to compile with electron-rebuild. Eventually I gave up and used an ancient version of Electron. I presume I've just missed the memo that ffi isn't used anymore or something. How do people call into DLLs in 2018?
|
# ? Dec 14, 2018 10:01 |
|
Nolgthorn posted:I think my issue with Typescript is just that ES2015+ is really really good. It does whatever I need without types when I write my code cleanly. More than that, I spend a lot of my time in Node, which immediately means Typescript is not nearly so useful to me. I do not want to compile my code if I don't have to and in Node my code is always going to run the same way. When I transition to the client side, I have very little reason to context switch my programming language. I sort of feel this way, but I also know that no matter how good ES2015+ is, typescript is there to protect me from myself.....
|
# ? Dec 14, 2018 15:48 |
|
Yeah, even if you don't need the extra features, then just enable JS scanning in tsc so you can see where you're being a bit sloppy.
|
# ? Dec 14, 2018 16:31 |
|
Is there a lazy way in Javascript to avoid making this mistake I always make when doing adventofcode sort of things?code:
|
# ? Dec 16, 2018 07:12 |
|
You can put a unary + operator in front of the variable to force it to cast to a number even if string, which is just one character to type as opposed to parseInt, so maybe then you'll remember to?
|
# ? Dec 16, 2018 07:20 |
|
Dumb Lowtax posted:You can put a unary + operator in front of the variable to force it to cast to a number even if string, which is just one character to type as opposed to parseInt, so maybe then you'll remember to? But it will at least make it less annoying and verbose when I notice and do the retroactive correction. vvvv Yeah, I got it, but that's where it's too late for me to cultivate a habit of doing it - converting at use-time rather than at capture-time. roomforthetuna fucked around with this message at 08:00 on Dec 16, 2018 |
# ? Dec 16, 2018 07:27 |
|
You'd have to doquote:console.log(+butt+(+rear end)) Wheee
|
# ? Dec 16, 2018 07:52 |
|
edit: I do not read well in the morning
|
# ? Dec 16, 2018 17:09 |
|
Yeah it's hard coming out of line.match. I doubt there's a way to use the + operator on the call itself that respects the destructuring of the returned object.
|
# ? Dec 16, 2018 17:37 |
|
Dumb Lowtax posted:Yeah it's hard coming out of line.match. I doubt there's a way to use the + operator on the call itself that respects the destructuring of the returned object. code:
|
# ? Dec 16, 2018 17:45 |
|
That seems MUCH better and more explicit to the reader. First line is about strings, second line is about numbers.
|
# ? Dec 16, 2018 18:21 |
|
Dumb Lowtax posted:That seems MUCH better and more explicit to the reader. First line is about strings, second line is about numbers. Learning about the unary plus already paid off today though, I'm pretty sure it saved me enough time to gain a position, and having talked about it also kept me from making the "forgetting to turn strings into numbers" mistake again, so thanks!
|
# ? Dec 17, 2018 07:23 |
|
if you need to parse an array from string into a number.. why not justcode:
|
# ? Dec 17, 2018 10:17 |
|
Strong Sauce posted:if you need to parse an array from string into a number.. why not just Yeah, do that.
|
# ? Dec 17, 2018 15:45 |
|
Whoa that is cool, class name as a constructor as a function pointer as a casting utility
|
# ? Dec 17, 2018 19:24 |
|
roomforthetuna posted:so there is no reader. You are the reader!
|
# ? Dec 17, 2018 19:25 |
|
Strong Sauce posted:if you need to parse an array from string into a number.. why not just That seems ambiguous. I prefer the explicit form. code:
|
# ? Dec 17, 2018 22:28 |
|
Nah, map(Number) is great. Its equally explicit and easier to read.
|
# ? Dec 17, 2018 22:31 |
|
It's not entirely clear what it's doing.code:
code:
code:
|
# ? Dec 17, 2018 22:59 |
|
Getting some weirdness when I type "JavaScript" out in another thread and it gets filtered to "java script". Doesn't happen here though??
|
# ? Dec 18, 2018 03:07 |
|
I’m messing around with Typescript and dependency injection. Separately, I like them both. Together, I hate them. So many decorators and incantations to wire everything together. I think it’s mostly the decorators. They feel like an extra layer of indirection to me.
|
# ? Dec 18, 2018 08:10 |
|
Dumb Lowtax posted:Whoa that is cool, class name as a constructor as a function pointer as a casting utility JavaScript code:
Kobayashi posted:I’m messing around with Typescript and dependency injection. Separately, I like them both. Together, I hate them. So many decorators and incantations to wire everything together. I think it’s mostly the decorators. They feel like an extra layer of indirection to me. Dependency injection in JS is usually at best a horrible leftover of the pre-import days.
|
# ? Dec 18, 2018 08:41 |
|
necrotic posted:Nah, map(Number) is great. Its equally explicit and easier to read. I’m not a huge fan of the readability because it doesn’t look like a function with the uppercase.
|
# ? Dec 21, 2018 13:50 |
smackfu posted:Im not a huge fan of the readability because it doesnt look like a function with the uppercase. I mean, it's Number, I think someone can count on devs knowing how that works. Hopefully.
|
|
# ? Dec 21, 2018 14:48 |
|
its for an advent project not dealing with credit card numbers or money... if you're just writing some quick function to convert an array of strings into numbers so you can add them up you're not exactly sanitizing data there... is parseInt returning NaN any better than Number returning 0 for empty string? well that depends on what you want to do. One allows for code:
But if it absolutely positively has to be an integer and you only want the integers code:
|
# ? Dec 21, 2018 21:54 |
|
Strong Sauce posted:its for an advent project not dealing with credit card numbers or money... Always specify a radix for parseInt.
|
# ? Dec 21, 2018 21:56 |
|
Roadie posted:
It looks cool and I feel like I almost see it, what it's it used for?
|
# ? Dec 21, 2018 22:21 |
|
Blinkz0rz posted:Always specify a radix for parseInt. this guy lints with airbnb
|
# ? Dec 22, 2018 06:25 |
|
Blinkz0rz posted:Always specify a radix for parseInt.
|
# ? Dec 22, 2018 08:37 |
|
Strong Sauce posted:Why? On the chance you're parsing some number that begins with "0" then some other digits, and you need to support IE8? then sure... but then you're also not going to be able to use Number.isInteger. There's that, there's also the famously surprising way that array.map(Number.parseInt) behaves.
|
# ? Dec 22, 2018 10:21 |
|
|
# ? Jun 3, 2024 22:11 |
|
Doom Mathematic posted:There's that, there's also the famously surprising way that array.map(Number.parseInt) behaves. edit: passing a radix was to address the issue of how parseInt handled "0"+<num> in IE8 or <ES5 browsers. additionally if you're using _map_ then parseInt(x, 10) is redundant since ES5 is when you got _map_ and then a formal definition of what the default radix is if it's not defined (10). so again giving advice to always specify a radix is outdated and useless. if we're talking about using map/filter then you're fine using parseInt without a radix. Strong Sauce fucked around with this message at 11:13 on Dec 22, 2018 |
# ? Dec 22, 2018 10:51 |