HackerTrans
TopNewTrendsCommentsPastAskShowJobs

mgreenw

no profile record

Submissions

'Do' More with 'Run'

maxgreenwald.me
43 points·by mgreenw·3 года назад·30 comments

comments

mgreenw
·в прошлом году·discuss
Puck is a marvel of drag and drop engineering and a wonderful open source project. Kudos to the team for this release!
mgreenw
·2 года назад·discuss
GCP charges for egress though. Agreed with OP, please bring Neon to GCP! Why Azure first?
mgreenw
·2 года назад·discuss
‘Twas a joke about JSON Web Tokens _sigh_

Note: my original comment said “JWT”
mgreenw
·2 года назад·discuss
Are we sure they verified the claims in that JSON Web Token?
mgreenw
·3 года назад·discuss
Exactly! I wrote a post about this pattern: https://maxgreenwald.me/blog/do-more-with-run
mgreenw
·3 года назад·discuss
I wrote a blog post about my experience with Dvorak!

TL;DR It's great, but if you're interested you should use Colemak. Once you switch you won't go back.

https://maxgreenwald.me/blog/switching-to-dvorak
mgreenw
·3 года назад·discuss
Try using `run` in the return of a React (or similar) component and you'll never go back ;)

There is always a balance here. I'm not saying to never extract a named function, and there is certainly good reason to do that, especially if the function is called elsewhere or is quite complex.

But, in many cases, the inline logic is more readable because it's right there, and the function really doesn't need a name.
mgreenw
·3 года назад·discuss
Same, I've written this so many times. Node just added this as a built-in utility FWIW

https://nodejs.org/api/timers.html#timerspromisessettimeoutd...
mgreenw
·3 года назад·discuss
> I am in love with “everything is an expression” from my time with Rust

Totally agreed! I wish JS had if expressions (maybe in the future?). It doesn't seem like such a huge change if it were rolled out slowly like other new syntax features but maybe I have no idea what I'm talking about.

Hopefully things like `run` can help move the needle on this. I like it because it feels more FP and intentional than IIFE's everywhere.
mgreenw
·3 года назад·discuss
Yes, I do think the extra parens are less readable.

Its not about number of characters, its about reasoning that the inline function that you just wrapped in parens is then called later, potentially after many lines. At least with `run` it's immediately clear based on the name that you are running the function.

Edit: This is pretty funny. I'm a parensaphobe! (not really) https://www.reddit.com/r/ProgrammerHumor/comments/qawpws/the...
mgreenw
·3 года назад·discuss
Completely agreed, and I use this if-based early return syntax frequently! That being said, I like using `if` and `else if` and `else`, but maybe that's just me! I don't think there's a substantial difference in readability or utility.
mgreenw
·3 года назад·discuss
Well you definitely can do that to my somewhat contrived example that is loosely based off of an example from the `do` expression proposal, but I'm not sure its better.

Part of the beauty of `run` is that you don't have to declare and name a function `calcX`. In longer and more complex examples, declaring a function inline like this is potentially confusing because you don't get to see where it is used, whereas with `run` you assign the return value immediately to a variable.
mgreenw
·3 года назад·discuss
Great, but the design and usability is still terrible compared to Slack. Not sure that can ever be fixed.
mgreenw
·3 года назад·discuss
Yea, but are any of those missing features required to run Snapchat?
mgreenw
·3 года назад·discuss
Yea that's fair, and I totally understand when sites limit to newer (last 2-3 years) versions of browsers or limit to Chrome, Safari, and Firefox.

But to cap it at just Chrome like its 2012 when browser compatibility has come such a long way is likely unnecessary and frankly lazy on their part. I can't think of an API that they definitely would need to use that isn't in Firefox.
mgreenw
·3 года назад·discuss
How is it possible that in 2023 they can't support Firefox and Safari?

Update: It works totally fine on Firefox if you use an extension to lie about your user agent. What a joke.