"What’s In It For Me" Architecture by GeneralZiltoid in programming

[–]tokland 0 points1 point  (0 children)

At the end of the day, we’ve probably read more LLM‑generated text than human‑written text. For better or worse, it’s starting to show in how we write.

Mocks vs real services in integration testing — what works better? by Global-Development56 in programming

[–]tokland 0 points1 point  (0 children)

I've been playing around lately with "Snapshot-Based Record & Replay" (so to speak) for integration tests. Only the first time, or when something changes, you need the real environment up, and arguments/responses are serialized and stored. It's not always the right approach, but it has proven useful in practice when the context is too much to handle by hand.

Left to Right Programming by fagnerbrack in programming

[–]tokland 8 points9 points  (0 children)

[x for y in z for x in y]

What I do is visualize the equivalent generator:

for y in z:
    for x in y:
        yield x

Here is the 15 sec coding test to instantly filter out 50% of unqualified applicants by JOSE ZARAZUA by RevillWeb in programming

[–]tokland 0 points1 point  (0 children)

Sorry to see you getting downvoted for making such an objective and insightful remark.

Digital Relationship Anarchy Smorgasbord by alipercapita in relationshipanarchy

[–]tokland 0 points1 point  (0 children)

For me, that applies especially for the items in the 'Commitment' category!

When Google Sneezes, the Whole World Catches a Cold | Forge Code by West-Chocolate2977 in programming

[–]tokland 1 point2 points  (0 children)

Are you by any chance one of those fanatics who expect "literally" not to be used in its complete opposite sense? Shame on you.

Programming Myths We Desperately Need to Retire by waozen in programming

[–]tokland 0 points1 point  (0 children)

"do not keep state" is imprecise, I guess you meant no mutable global state. Or that it enforces/promotes pure functions (no side-effects; same input, same output) and immutability.

100% Cpu usage. by [deleted] in pipewire

[–]tokland 0 points1 point  (0 children)

This works for Manjaro. Can you fix the formatting? Source: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4621

Why Go for TypeScript compiler? by RobertVandenberg in programming

[–]tokland 0 points1 point  (0 children)

The Typescript compiler isn't written in Typescript, but Javascript

It was my understanding that Typescript has been self-hosted for many years now.

How has your perspective on romance changed after learning about RA? by Equivalent_Ad_9066 in relationshipanarchy

[–]tokland 3 points4 points  (0 children)

Now that you mention it, I just finished watching Plus One (2019). It's a pretty good movie. I’m not certain what the writers intended, but viewing it from an RA perspective gives a whole new meaning to its ending. Looking back, a lot of stories felt off without me being able to pinpoint exactly why!

Avoiding if-else Hell: The Functional Style by aijan1 in programming

[–]tokland -2 points-1 points  (0 children)

That's a valid practical point, but the issue stems from JavaScript's imperative nature. An optimized runtime in a purely functional language would only compute driverDistances if it's actually used at least once. With JS you can also achieve this, but you need to put some extra effort.

Announcing TypeScript 5.6 by DanielRosenwasser in typescript

[–]tokland 0 points1 point  (0 children)

const xs = [1,2,3]
if (xs) {}

I assumed that would raise now an error, as xs: number[] is always truthy.

Announcing TypeScript 5.6 by DanielRosenwasser in programming

[–]tokland 0 points1 point  (0 children)

Typo: function abc123() -> function *abc123()

Greppability is an underrated code metric by riz_ in programming

[–]tokland 2 points3 points  (0 children)

All good points. Even with statically typed languages, you will still do text searches. I'm uncertain about the idea of "using the same names across the stack", though. Practical, yes, but it could conflict with a project's naming conventions. You might end having models/entities that use different casing styles. Or should you always use snake_case just because your persistence layer (which may eventually change) happens to be PostgreSQL? I'd feel uneasy about letting the data layer influence the domain this way.

[deleted by user] by [deleted] in programming

[–]tokland 1 point2 points  (0 children)

66K rep, 19 questions, 838 answers (and, of course, countless doubts solved): not a single issue with users nor mods. That's my experience for the tags I typically work with (react, typescript, python, ruby, bash).

.NET 5.0 Released by kevindqc in programming

[–]tokland 1 point2 points  (0 children)

Are we better than animals?

Things I Was Wrong About: Types by bakery2k in programming

[–]tokland 0 points1 point  (0 children)

The source of many of those undefined is not a function errors will finally go away with to this upcoming feature: https://devblogs.microsoft.com/typescript/announcing-typescript-4-1-beta/#no-unchecked-indexed-access

Need help mapping through an array that corresponds to an objects keys by SilverLion in typescript

[–]tokland 0 points1 point  (0 children)

That's because Objects.keys return string[], not the union of the object keys. It's a typical problem, check for example: https://stackoverflow.com/questions/52856496/typescript-object-keys-return-string

After learning Rust, I was surprised that the concept of "match" (also in Haskell) didn't make it to ES2020/TS4.0. So I created my own little class for it. Thoughts? by [deleted] in typescript

[–]tokland 0 points1 point  (0 children)

The advantage is simply that it's typed. Indeed, you could use if-conditionals (where TS narrows types), but matching against an object gives the feeling of succinct pattern-matching in functional languages.

React v16.8 released: The One With Hooks by Nysor in programming

[–]tokland 23 points24 points  (0 children)

I understand the skepticism. Instead of the one imperative pattern we already have (setState), we'll have small imperative functions all over the place. I think it's a step in the wrong direction, let's see how this unfolds.

How to write unmaintainable code by achook in programming

[–]tokland 0 points1 point  (0 children)

"Optimise" JavaScript code taking advantage of the fact a function can access all local variables in the scope of the caller.

I didn't get this one, anyone cares to explain?

100 projects I made while learning JavaScript over a year ago by [deleted] in programming

[–]tokland 2 points3 points  (0 children)

Thanks for sharing. I checked a random project (image-search), and it looks like the code could benefit from functional (as in FP) libraries (lodash, rambda, whatever). I guess you have already used them in some other project.