←back to thread

517 points bkolobara | 3 comments | | HN request time: 0.768s | source
Show context
gedy ◴[] No.45042251[source]
> Assigning a value to 'window.location.href' doesn't immediately redirect you, like I thought it would.

That's not a "Typescript" or language issue, that's a DOM/browser API weirdness

replies(3): >>45042856 #>>45043364 #>>45045727 #
1. gavmor ◴[] No.45042856[source]
Jeeze, why should attribute assignment have side-effects, anyway? That'd be gross!
replies(1): >>45048440 #
2. scheme271 ◴[] No.45048440[source]
I think it's unavoidable for any sufficiently complicated object or variable. Think of c++'s unique_ptr that guarantees that only a single reference to memory exists so that that the memory can be free'd safely when it goes out of scope. Or thing of a complicated object that has references to allocated memory. You either allocate a bunch of memory and copy values over or have two objects refer to the same bit of allocated memory. Each solution potentially has major downsides. Your objects don't even have to be all that exotic, think of a vector holding 1024 fp64 values or a 8kb long string.
replies(1): >>45076416 #
3. gavmor ◴[] No.45076416[source]
Yikes, sharing the same bit of memory seems like a Demeter violation! Is it really all that common? Maybe I am too OOP-pilled to grok the sense of it.