Service workers are threads. They’re basically separate JavaScript processes you communicate with with IPC, with other special privileges and capabilities allotted to them.
564 karma · joined December 18, 2018
Service workers are threads. They’re basically separate JavaScript processes you communicate with with IPC, with other special privileges and capabilities allotted to them.
Edit: also, if an attacker dumps all the data today then loses access to the data tomorrow, having access to my password hashes means they can access my account and data later.
This comment is an example of why I wouldn’t want any given website to choose my password.
I was misunderstanding your point with the deserialize.
Edit: “using” -> “uses”
The correct type for values you don’t know the type of (like the response of an API call) is “unknown”.
TypeScript does not provide the facilities you describe because there is not a one-size-fits-all solution to the cases that are possible and common in JavaScript.
It is left to the developer to decide how to validate unknown data at the boundaries of the API.
There are third party libraries that facilitate this in different ways with different trade-offs.
The compiler actively lies to you about the types you’ll have at runtime.
I find this to be rare if you are using strict mode with proper TypeScript definition files for your platform and dependencies. Usually the lie is in your own code or bad dependencies when an “unknown” type (including “any”) is cast to a concrete type without being validated. In nearly any other typed language I have some deserialization mechanism.
Could you provide examples? I either don’t understand or I disagree.This is not meant as an argument against what you’re saying, because I know you were just giving an example, but I found this and thought you may find it interesting: https://www.hacklewayne.com/a-truly-strongly-typed-printf-in...
You're forced to emulate exactness by always destructuring objects - not great.
It’s almost like using objects as enumerable maps is an anti-pattern.https://github.com/Microsoft/TypeScript/wiki/TypeScript-Desi...
Edit:
Non-goals:
…
5. Add or rely on run-time type information in programs, or emit different code based on the results of the type system. Instead, encourage programming patterns that do not require run-time metadata. Also you should fill your database with houses - use AI or some sort of random data generator to generate them and just make sure there's a small but clear note on the listing saying this is AI data. It's not ideal but it is better than an empty database. Give people something to look at.
This genuinely made my stomach turn. If this is the future… I don’t know if I want in.In the movie, they of course have the technology to do these things, but it’s usually used for “extraction”: stealing information and ideas from one’s subconscious by infiltrating their dreams.
“Inception”, as used in the movie, is just the opposite of “extraction”: to plant an idea in someone’s subconscious by infiltrating their dreams.
So while I think it’s a stretch, it’s not as bad as suggesting that people can commingle in dreams.
If you find yourself struggling to articulate it, seriously and honestly consider whether you’re simply choosing to be stressed about it.
I’m speaking from experience here.
Edit: I truly did not believe you, but it appears to maybe be the “delay” feature [0]. Users with a delay set might show the asterisks until the delay passes.
My apologies.
I recognize this is a preview and I desperately hope this implementation isn’t kept around and treated as a quirk.
This implementation is extremely unintuitive given their explanation of the expected behavior of CSS Nesting and the & symbol.
To quote:
The & signals to the browser “this is where I want the selector from outside this nest to go”.
Their explanation and the actual implementation result in a majorly different CSS selector.The implemented functionality, however useful, makes no sense as a default if one can explicitly use :is to achieve this behavior like below.
.foo .bar {
.baz :is(&) {
}
}
The default should behave like they claim it does; simply replace & with the “outside” selector.What I was saying is that just because spaces in prose naturally improves visibility does not _necessarily_ mean that underscores and dashes improve overall readability across many contexts _in real code_, because code and prose are different. It could be the case, but it’s not the obvious innate property people are suggesting it is.
If it such an obvious innate improvement in readability, then why don’t we replace spaces with underscores in prose and handwriting? It would remove any ambiguity between intentional separation and awkward unintentional spacing or kerning. But we don’t and haven’t done that for some reason, so there must be something else at play.
Your examples (and many examples in this thread) of long sentences in these formats are not what code actually look like.
Real code has meaningful symbols and syntax that occur between identifiers that carry semantic meaning. Maybe the lack of symbols in identifiers in camel and pascal case make it easier to identify these other symbols and syntactic elements, so you end up with better overall readability. Maybe adding to that the flexibility of using camel and pascal and upper snake case for different "types" of identifiers improves mental mapping of code concepts that you'd lose if you always used snake case.
Again, I'm only making the argument that readability in code and readability in prose are two totally different things, and the effects of different casing and different identifier naming schemes are likely more subtle than what is better clearly separating words in the identifier.
In code, you have to balance readability in many contexts.
Snake case and kebab case look more readable in isolation, but do they look better when used as part of a larger expression, for example part of a chain of member access and method calls and argument passing? I don’t think the answer is obvious, and it probably depends on other formatting affordances (e.g. breaking the expression up on multiple lines).
I’m on mobile and I don’t trust HN’s formatting to do any justice with examples, but it might be worth trying it out in your code editor.
Why can't the style simply imply how much scope and importance an identifier has?
Because lack of underscores doesn’t unanimously imply lack of importance or scope.For example:
left |> right
Would semantically translate to: right(left)
And you could define a pipeline function like so, where the following: const myPipeline = @[
one(@),
@.two(),
@ + three,
`${@} four`
]
Would translate to: const myPipeline = (value) => {
const _1 = one(value);
const _2 = _1.two();
const _3 = _2 + three;
const _4 = `${_3} four`;
return _4
}
Or: const myPipeline = (value) => `${one(value).two() + three} four`;
And you could define the placeholder value name (which would allow nesting): const myPipeline = @it [
one(@it),
@it.two(),
@it + three,
`${@it} four`,
]
You'd combine the two syntaxes to get immediately-invoked pipeline functions: // Using a modified example from the proposal:
envars |> @ [
Object.keys(@),
@.map(envar => `${envar}=${envars[envar]}`),
@.join(' '),
`$ ${@}`,
chalk.dim(@, 'node', args.join(' ')),
console.log(@),
]
This is better, in my opinion, than building the '%' placeholder syntax into the pipe operator.