|
HappyHippo posted:effortpost but whatever. if "readability" means anything it should be related to the mental burden the code requires to understand it. one aspect of that is "do i need to understand all the details to understand the big picture?" if i do, the readability is poor because i can only keep so much info in my head at once. much better if you can understand the big picture before you read the details I actually find the first easier to read than the second then again I also really don't like filter at al, at least unless it's genuine filtering rather than some chained transform monstrosity I don't mind lambdas and for_each though Private Speech fucked around with this message at 20:49 on Dec 2, 2021 |
# ? Dec 2, 2021 20:45 |
|
|
# ? Apr 25, 2024 07:36 |
|
I don't know why anyone would use Javascript when Typescript is right there. It seems like half the problems with JS is from the extraordinary weak typing.
|
# ? Dec 2, 2021 21:32 |
|
As soon as I see map or filter I assume someone is being too clever for their own good.
|
# ? Dec 2, 2021 22:13 |
|
nested ternary and comments is gross imho because if you multiline it you're putting comments inside the brackets and then ending with some horrid ))) at the end. just use if statements with indentation, there's no prize for brevity. That said: Shaggar posted:there used to be a handful of places where terneries were ok, but they've been supplanted by better syntax. I love ?? When I remember it exists but every time I use it I think "someone's gonna hate me for this" Powerful Two-Hander fucked around with this message at 22:16 on Dec 2, 2021 |
# ? Dec 2, 2021 22:14 |
|
today's adventure was that I accidentally broke all the loggers by loving up setting a lifecycle policy on the elastic indexes, or more accurately setting that correctly but in the process applying an index template with the ootb "logs" definition which it turns out completely fucks Serilog if you're not using neweer versions. Stated reason: "oh that field changed from _butts to _balls in later versions of elastic", god the docs for this suck. turns out nobody looks at any logs apart from me though because nobody noticed none had been written for 24 hours!
|
# ? Dec 2, 2021 22:19 |
|
i have three tickets for tomorrow thats justs deleting poo poo
|
# ? Dec 2, 2021 22:26 |
|
HappyHippo posted:whereas with the second i need to read all the clauses of the if/else to know that they're assigning to x and that's all they do. idk if it's disallowed to return/break/continue from a ternary or if it just doesn't happen much, but yeah I like that aspect The Wisest Moron posted:I don't know why anyone would use Javascript when Typescript is right there. It seems like half the problems with JS is from the extraordinary weak typing. lack of a compile step or dependencies can be nice but I agree as soon as you add either
|
# ? Dec 2, 2021 22:32 |
|
oh god i forgot advent of code was a thing
|
# ? Dec 2, 2021 22:39 |
hbag posted:oh god i forgot advent of code was a thing you have plenty of time to get in on the action
|
|
# ? Dec 2, 2021 22:42 |
|
Powerful Two-Hander posted:nested ternary and comments is gross imho because if you multiline it you're putting comments inside the brackets and then ending with some horrid ))) at the end. just use if statements with indentation, there's no prize for brevity. what? to be clear code:
|
# ? Dec 2, 2021 22:44 |
|
cinci zoo sniper posted:you have plenty of time to get in on the action also there is absolutely no chance you will be on the leaderboard, so there is no pressure. on the first two days the 100 people on the leaderboard completed both of the daily tasks in under 3 minutes after they were published. it took me longer than that to get the input file opened.
|
# ? Dec 2, 2021 22:56 |
|
Presto posted:As soon as I see map or filter I assume someone is being too clever for their own good. ok graybeard
|
# ? Dec 2, 2021 23:01 |
|
Presto posted:As soon as I see map or filter I assume someone is being too clever for their own good. map is just "convert a collection of things to a collection of other things" and filter is just... filtering? like Java code:
|
# ? Dec 2, 2021 23:02 |
|
ternaries are often good for setting struct fields. can't think of a time when i'd prefer nesting them to if/else, though.
|
# ? Dec 2, 2021 23:03 |
|
HappyHippo posted:what? to be clear I guess I was thinking of javascript, specifically those examples earlier? Idk. I guess I use nested statement s like that so rarely I have just gone to if statements when it's more than one case.
|
# ? Dec 2, 2021 23:06 |
|
Powerful Two-Hander posted:I guess I was thinking of javascript, specifically those examples earlier? Idk. I guess I use nested statement s like that so rarely I have just gone to if statements when it's more than one case. and it's not like most ides won't flip one to the other seamlessly.
|
# ? Dec 2, 2021 23:09 |
|
Presto posted:As soon as I see map or filter I assume someone is being too clever for their own good. lol that’s certainly a take “these functions that are semantically clearer than looping are bad, only eggheads use them”
|
# ? Dec 2, 2021 23:48 |
|
Arcsech posted:“these functions that are semantically clearer than looping are bad, only eggheads use them” this but unironically jk i use collection comprehensions all the time theyre the best
|
# ? Dec 2, 2021 23:49 |
|
If your nested ternaries are complex and inscrutable enough to require comments on multiple lines (versus perhaps one explanatory comment immediately above) then you're golfing and probably a chain of if/elses would be better.
|
# ? Dec 2, 2021 23:51 |
|
Powerful Two-Hander posted:I guess I was thinking of javascript, specifically those examples earlier? Idk. I guess I use nested statement s like that so rarely I have just gone to if statements when it's more than one case. js gets the precedence right. php is the only mainstream language that gets it wrong.
|
# ? Dec 2, 2021 23:57 |
|
sql case when is the "better" way of implementing nested ternary expressions
|
# ? Dec 3, 2021 00:25 |
|
ugh here's a horror I saw today: using a CASE statement in a subquery that then either returned an integer or 'No', and then left joined on the value matching to another int and the value not equalling the string 'No'. SQL type cooercion
|
# ? Dec 3, 2021 00:36 |
|
Jabor posted:sql case when is the "better" way of implementing nested ternary expressions
|
# ? Dec 3, 2021 00:36 |
|
toiletbrush posted:doesn't case-when not require an else though? forcing you to handle each case is what's great about ternaries Ignore me I realised I was thinking of something completely different. Leaving this here though: so of course your have your else return '???' (I have literally seen this) Powerful Two-Hander fucked around with this message at 00:48 on Dec 3, 2021 |
# ? Dec 3, 2021 00:40 |
|
If your expression doesn't produce a value then your output row will have a null in it. Same as if you do an outer join and there's nothing to match against. If you implemented that syntax in an imperative programming language then you'd probably require the else case, yeah.
|
# ? Dec 3, 2021 01:00 |
ansi sql case statements have else as optional clause
|
|
# ? Dec 3, 2021 02:03 |
https://aws.amazon.com/about-aws/whats-new/2021/12/aws-sdk-rust-developer-preview/ developer preview for aws rust ask
|
|
# ? Dec 3, 2021 02:17 |
|
they have kotlin and swift now too
|
# ? Dec 3, 2021 02:38 |
|
esac
|
# ? Dec 3, 2021 07:17 |
|
The Binding of esac
|
# ? Dec 3, 2021 08:10 |
|
Arcsech posted:“these functions that are semantically clearer than looping are bad, only eggheads use them” this is what i was trying to say, but the words escaped me
|
# ? Dec 3, 2021 08:25 |
|
map/filter/fold/etc whip rear end.
|
# ? Dec 3, 2021 08:38 |
|
Share Bear posted:this but unironically except for every time I have to use them in Python and remember that filter of an array doesn't output an array but a single use iterator and I don't like it
|
# ? Dec 3, 2021 09:25 |
|
Jabor posted:If your expression doesn't produce a value then your output row will have a null in it. Same as if you do an outer join and there's nothing to match against. sql is a bit of a tragedy because the "runtimes" are so freaking good but it's impossible to fix the relatively minor design flaws in its frontend type coercion, pervasive nulls, no null vs undefined distinction, clunky and limited "variables" (ctes and temp tables)... any other language with such wide adoption would have since sprouted a runtime-compatible with those frontend flaws fixed. java -> kotlin, js -> ts, erlang -> elixir etc. every few years somebody tries to make sql 2.0 that compiles to sql and it never catches on because compiling to a language that is almost fully declarative and only barely standardized is leaky as hell, and also its flaws aren't so bad for 95% of its use cases (basically any program under 200 lines or so)
|
# ? Dec 3, 2021 10:04 |
|
Presto posted:As soon as I see map or filter I assume someone is being too clever for their own good.
|
# ? Dec 3, 2021 10:31 |
|
NihilCredo posted:
who remembers linq2sql/entity framework? what a loving disaster that was
|
# ? Dec 3, 2021 10:53 |
|
https://twitter.com/fesshole/status/1466699991746244610?t=kySgGOUKvPP4DZG15LKcng&s=19 I swear that wasn't me ( i actually wrote some unit tests two weeks ago)
|
# ? Dec 3, 2021 11:01 |
Powerful Two-Hander posted:https://twitter.com/fesshole/status/1466699991746244610?t=kySgGOUKvPP4DZG15LKcng&s=19 this piece of poo poo im working on is like 10 times more difficult to test than to actually implement, im probably not going to bother even (because ive got a month left here lmao). it’s the perfect storm of a third party process marshalling my code, which in turn is balls deep in abstraction layers of our orchestration framework, and every operation is like “read 100 terabytes from A and copy it into B” cinci zoo sniper fucked around with this message at 12:01 on Dec 3, 2021 |
|
# ? Dec 3, 2021 11:19 |
|
I'm trying to run a phpunit test but it won't loving pick up my env vars
|
# ? Dec 3, 2021 12:00 |
|
|
# ? Apr 25, 2024 07:36 |
|
Apparently I get to maintain a bunch of Go code, because the teams using our library from Go cannot be trusted to do the sane thing and write common utility functions once, so there are now 4 subtly different versions of conceptually same code between different go projects. What is a good Go tutorial?
|
# ? Dec 3, 2021 12:42 |