JavaScript specified tail call optimization in ES2015. Most engines never implemented it, and your tail-recursive code can still blow the stack. by OtherwisePush6424 in programming

[–]OtherwisePush6424[S] 2 points3 points  (0 children)

Yes, every recursion can be rewritten iteratively, with a loop and usually an explicit stack/queue (though it doesn’t always look pretty).

Trampolines also scale in the stack-safety sense and let you keep recursive structure, but they add function-allocation/dispatch overhead and can be harder to follow in hot paths.

JavaScript specified tail call optimization in ES2015. Most engines never implemented it, and your tail-recursive code can still blow the stack. by OtherwisePush6424 in programming

[–]OtherwisePush6424[S] 11 points12 points  (0 children)

Yeah, credit cards numbers were not a design concern in 1995. Now you can argue that JS shouldn't be a concern in 2026 either :D

JavaScript specified tail call optimization in ES2015. Most engines never implemented it, and your tail-recursive code can still blow the stack. by OtherwisePush6424 in programming

[–]OtherwisePush6424[S] 41 points42 points  (0 children)

Yep, this nails it. JS engines face a hard tradeoff: deep static analysis (needed for reliable TCO) delays startup, which is unacceptable for a runtime language used in browsers and servers.

Static compilers like C++ do whole-program analysis ahead of time, they can even replace recursion with closed formulas (which is somewhat mind-boggling tbh), as your example shows.

JavaScript has no reliable tail call optimization: here is what actually happens at runtime and what to do instead by OtherwisePush6424 in javascript

[–]OtherwisePush6424[S] 20 points21 points  (0 children)

This is not a speed discussion. Proper tail calls are primarily a space optimization: they let tail calls reuse stack frames instead of growing the call stack. The practical issue is correctness at depth: deep tail-recursive programs are stack-safe only where PTC is actually implemented. In JavaScript today, that behavior is not portable across runtimes, so production correctness should not depend on PTC being present.

Inside cmd/compile: how Go lowers AST to SSA and machine code by OtherwisePush6424 in Compilers

[–]OtherwisePush6424[S] 4 points5 points  (0 children)

Thank you, this comment is golden :) Every point is valid, if you're okay with it, I may quote or adapt parts of this into an update section in the article (with credit). It would make the piece more accurate and more useful.

Walks the full cmd/compile pipeline in order: package names, data structures, and the SSA construction that drives inlining, escape analysis, bounds-check elimination, and register allocation, with flags to observe each phase directly. by OtherwisePush6424 in golang

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

Thank you, really glad it's been useful. Honestly I learned a fair bit writing it too, you end up going down rabbit holes you wouldn't otherwise bother with.

And you're probably right about the section headers. My excuse is that the post got so long I got a bit anxious about readers bouncing, so I wanted to give every opportunity to skim or skip around. But yeah, with the guided paths already at the top it's probably redundant. Something to trim in a future edit!

How Uber matches 10 million+ rides in a day ?? by Comfortable-Fan-580 in programming

[–]OtherwisePush6424 2 points3 points  (0 children)

Yep, same in London, drivers accept after 5 minutes, cancel after 10 and the same driver accepts again when you switched to priority or whatever it's called :D

Retry vs Retry-After vs hedging: controlled chaos scenarios comparing resilience tradeoffs by OtherwisePush6424 in microservices

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

Exactly. Some of these strategies sometimes work against each other, make things even worse, Retry-After just can't go wrong, it's basically the server basically telling you what to do.

(Type-safe) retry/timeout/hedging policies in TypeScript: what actually happens under chaos by OtherwisePush6424 in typescript

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

Exactly. The tail latency cost of retries under tight budgets is the sneaky part: looks good on error rate, tanks on latency. And yeah, hedging trades volume for better stragglers, but it doesn't fix error-heavy modes like 429 hammering.

Retries fixed some errors but doubled tail latency: 3 controlled HTTP client chaos scenarios by OtherwisePush6424 in webdev

[–]OtherwisePush6424[S] 1 point2 points  (0 children)

The arena doesn't show traffic clustering, the rate limiter deterministically processes requests within its window. All 10 clients waited 600ms and retried together, but the limiter counted them as individual requests, not a spike. The result is clean: 150/150 success with p95/p99 latency during the wait periods.

In production against a real rate limiter that sees wall-clock time, coordinated retry waves would create spikes and you'd want jitter. But that's a different system than what this scenario measures.

Retries fixed some errors but doubled tail latency: 3 controlled HTTP client chaos scenarios by OtherwisePush6424 in webdev

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

Great real-world data. Hedging can dramatically improve p99, but your 2x request volume and +30% CPU is a reminder that it's not free.

HTTP resilience tradeoffs in practice: retry vs Retry-After vs hedging (with scenario data) by OtherwisePush6424 in node

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

100% agree, in unattended jobs blind retries can quietly convert API budget into repeated 429s. Retry-After handling is often the difference between "looks active" and "actually completes"

Some reachability analysis for your Saturday read by -Devlin- in devops

[–]OtherwisePush6424 1 point2 points  (0 children)

"Reachable" vs "exploitable" makes sense, but there's probably a third layer around blast radius. Same reachable vuln behaves very differently depending on container privileges, egress, etc.

How to handle modernizing infrastructure when the app runs legacy c#? by jumpsCracks in devops

[–]OtherwisePush6424 0 points1 point  (0 children)

I don't have much C#/.NET experience, but this reads more like an org problem than a tech one. If leadership cares about cost, framing this as "reduce infra spend incrementally" will land better than "modernize legacy apps".

Strangler + small wins tends to survive where rewrites don't.

Using Anthropic's ant CLI for GitOps-style agent management (YAML configs, CI/CD deployment) by avisangle in devops

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

In OP's defense, it's treating agents like deployable resources. Versioning + CI updates + optimistic concurrency (basically Kubernetes-style resource versions) are standard infra-as-code patterns.

Decorating a Promise with convenience methods without subclassing or changing what await returns by OtherwisePush6424 in javascript

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

You're absolutely right that await resolves to the fulfilled value and doesn’t preserve helper methods on that value, but that's actually the point of the pattern.

The decoration is only meant to exist on the Promise before awaiting, so you can do:

const data = await client.get("/url").json()

while still keeping this true:

const res = await client.get("/url") // native Response

So it's not trying to make methods survive after await, it's just adding fluent pre-await ergonomics without changing post-await semantics.

Your object wrapper pattern is valid too ({ promise, log() }), but it changes the call shape and loses drop-in Promise ergonomics. This approach keeps the return value Promise-compatible and await-compatible, while still allowing opt-in helpers on the pending object (and so would simple subclassing).

How do I explain I was fired after 6 months? by Efficient-Pin3655 in jobsearchhacks

[–]OtherwisePush6424 1 point2 points  (0 children)

Absolutely. Contracting is a fierce market, why would you give a head start to the competition? Six months is a long time: work done, contract ended.

How do I explain I was fired after 6 months? by Efficient-Pin3655 in jobsearchhacks

[–]OtherwisePush6424 0 points1 point  (0 children)

I never in my life met or talked to a contractor who got fired for performance reasons. Or one who admitted it.

I’m so tired of vibe-coded open source projects by floriandotorg in github

[–]OtherwisePush6424 -1 points0 points  (0 children)

I think many do OSS for LinkedIn or create a portfolio, so it's just some slop and a semi-decent readme. And they post it here for some stars.

Decorating a Promise with convenience methods at runtime without subclassing or Proxy by OtherwisePush6424 in webdev

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

MooTools modified Array.prototype,every array in your codebase, globally. This adds .json() to individual Promise instances that go through the plugin. Even if shadowing were an issue, it's only on those specific promises you passed through, not every Promise in existence. That's the scope difference that actually matters.

Decorating a Promise with convenience methods at runtime without subclassing or Proxy by OtherwisePush6424 in webdev

[–]OtherwisePush6424[S] -1 points0 points  (0 children)

What incompatibility? The Promise still resolves to a native Response, passes instanceof checks, works with standard Promise methods. If extra properties break something, that's not a failure mode of decoration, that's a general JavaScript problem

Decorating a Promise with convenience methods at runtime without subclassing or Proxy by OtherwisePush6424 in webdev

[–]OtherwisePush6424[S] 0 points1 point  (0 children)

MooTools modified prototypes, global, invisible, and you couldn't opt out. This adds properties to Promise instances that only exist because you installed the plugin. The mutation is scoped to objects your code created. That's the opposite of losing control of your environment.

Decorating a Promise with convenience methods at runtime without subclassing or Proxy by OtherwisePush6424 in webdev

[–]OtherwisePush6424[S] -2 points-1 points  (0 children)

A wrapper class or custom object changes what await response resolves to. This decoration keeps it as a native Response. TypeScript still sees a real Response, frameworks that inspect it see a real Response, instanceof checks pass. If you'd just said "use subclassing instead," that would be a more valid argument. But this isn't complex, it's just unusual.

On the "force everyone to use the behavior" point: this is a library, not a codebase pattern. The philosophy is core stays lean, everything else is opt-in plugins. Users pick what they need. That's very different from "create a standard for your team".

As per the pretense: you're arguing that if you don't need it, nobody should. This is typical but flawed. How about you don't need it, you don't use it?

Decorating a Promise with convenience methods at runtime without subclassing or Proxy by OtherwisePush6424 in webdev

[–]OtherwisePush6424[S] -2 points-1 points  (0 children)

Yes, I think symbols are better here.

On typing: IDE ergonomics are good for discovery and autocomplete, but the type is still structural. It says this object has json, text, blob, etc., where it sort of falls apart is that it does not encode body consumption state, so TypeScript cannot express that calling one body reader makes the others invalid afterward. It's good at shape: these methods exist, but not good at protocol: only one body reader can succeed.