Live data from Hacker News

A complete guide to TypeScript’s 'never' type

zhenghao.io

41–50 of 64 posts

Re: A complete guide to TypeScript’s 'never' type

#41
post #6

Earlier quoted context omitted.

I have seen such double negative at many places, to represent strong negative. Don't know if it is some trend!

It’s fairly common usage in the US southeast, and in AAVE. Regarding it as poor grammar rather than an evolution of dialect is a matter of (snobbish) taste more than anything.

The more northern dialects are infected with certain negation-related illogicalities too. Consider this New York Times headline:

“All Options Are Not on the Table as Biden Moves Troops Closer to Ukraine” https://www.nytimes.com/2022/02/05/us/politics/biden-ukraine...

which should have been “Not All Options Are on the Table”, since the intended interpretation is

¬∀ option, on(option, table)

rather than the very different

∀ option, ¬on(option, table).

Re: A complete guide to TypeScript’s 'never' type

#42
As long as you're stuck with null and undefined, you might as well throw in never for $3 billion!

"My favorite is always the billion dollar mistake of having null in the language. And since JavaScript has both null and undefined, it's the two billion dollar mistake." -Anders Hejlsberg

"It is by far the most problematic part of language design. And it's a single value that -- ha ha ha ha -- that if only that wasn't there, imagine all the problems we wouldn't have, right? If type systems were designed that way. And some type systems are, and some type systems are getting there, but boy, trying to retrofit that on top of a type system that has null in the first place is quite an undertaking." -Anders Hejlsberg

Re: A complete guide to TypeScript’s 'never' type

#43

Earlier quoted context omitted.

>Most of the grammatical "rules" we tend to be taught in primary and secondary school English courses were invented relatively recently, and they were created specifically for the purpose of establishing an arbitrary class distinction. That's a very hefty accusation. Do you have any proof that "they were created specifically for the purpose of establishing an arbitrary class distinction"? >Now, there's something to b…

> Do you have any proof that "they were created specifically for the purpose of establishing an arbitrary class distinction"? Apologies; you are correct that my assertion is overly strong. I should rather have said "although we can no longer ascertain for certain the purpose for which these rules were introduced, some believe the origin to be rooted in a desire for creating an arbitrary class distinction." Many of th…

>I should rather have said "although we can no longer ascertain for certain the purpose for which these rules were introduced, some believe the origin to be rooted in a desire for creating an arbitrary class distinction."

That sounds more believable. Some people believe that, and some people believe that moon landing wasn't real. Many languages like Spanish, French, Russian or Chinese are regulated on the national or even supranational level. That feels like a good thing and it shouldn't be discouraged just because some people believe in weird things.

>No, markedness is not also known as "poor grammar". There is a huge distinction. >But "poor grammar" specifically seeks to attribute a negative connotation to the utterance. It says suggest that people who construct such utterances are, somehow, uneducated, or else are outsiders. It says that they've done something that is objectively (not subjectively) incorrect or wrong.

Markedness is just as objective as poor grammar. It is all about a specific group of people in a specific time and place. As time changes so does grammar and what is consider poor.

>Not always. Again, the terms are distinct in intent.

Well, in the strict sense "markedness" has different meaning. The way you described more or less resembles poor grammar in most cases.

>I don't think most Americans would listen to an English person say "I will go on holiday" and call it "poor grammar". They might say "that sounds funny" or "I'd never say it that way" or whatever else, but I think most would not use a phrase with such a strongly negative connotation.

They probably understand that it is a standardized learned prestige dialect.

>So my desire to distinguish markedness from "poor grammar" is rooted in a desire to fight stigmatization. There is nothing inherently wrong with those latter examples I gave, especially because almost all native English speakers will understand their intents (at least generally) without issue.

Yes, I understand. Americans have a knee-jerk reaction against everything that feels a tiny bit racist. However propping up a single standardized language and discouragement of deviations is a path that most nation-states have embraced.

Re: A complete guide to TypeScript’s 'never' type

#44

As long as you're stuck with null and undefined, you might as well throw in never for $3 billion! "My favorite is always the billion dollar mistake of having null in the language. And since JavaScript has both null and undefined, it's the two billion dollar mistake." -Anders Hejlsberg "It is by far the most problematic part of language design. And it's a single value that -- ha ha ha ha -- that if only that wasn't th…

But it's worse that that.

    var foo = new Array(5)
That code will make an array with 5 elements, but their values aren't actually null or undefined, but another kind of "empty" value. You can't access this value directly (it will convert to undefined), but it still exists.

EDIT: there's another kind of undefined that happens within the Temporal Dead Zone too

Re: A complete guide to TypeScript’s 'never' type

#45

Earlier quoted context omitted.

It’s fairly common usage in the US southeast, and in AAVE. Regarding it as poor grammar rather than an evolution of dialect is a matter of (snobbish) taste more than anything.

The more northern dialects are infected with certain negation-related illogicalities too. Consider this New York Times headline: “All Options Are Not on the Table as Biden Moves Troops Closer to Ukraine” https://www.nytimes.com/2022/02/05/us/politics/biden-ukraine... which should have been “Not All Options Are on the Table”, since the intended interpretation is ¬∀ option, on(option, table) rather than the very differ…

I am never not confused by this.

Re: A complete guide to TypeScript’s 'never' type

#46
post #15

Earlier quoted context omitted.

Any sources on poor grammar being a new thing? It's been taught in public/private schools in England for centuries, maybe even millennia.

Sorry, I think I was not clear enough. There have certainly been efforts to draw arbitrary distinctions between groups based on speech for a very long time, probably going almost as far back as language itself. What I was referring to was specifically an effort rooted in a desire to use rules of Latin grammar to restrict constructions in English. This was a big thing relatively recently (likely sometime in the past 1…

Those things are irrelevant to the question of whether "never can't never" is incorrect in context, which is what you were replying to. Nor was the comment you replied to trying to draw distinctions between groups.

Re: A complete guide to TypeScript’s 'never' type

#47

> Since there’s no values in the set, never type can’t never (pun-intended) have any value That’s not a pun that’s just poor grammar. “never type can never (pun-intended) have any value” makes sense.

> That’s not a pun that’s just poor grammar. There is no such thing as "poor grammar" --- it's a myth. Most of the grammatical "rules" we tend to be taught in primary and secondary school English courses were invented relatively recently, and they were created specifically for the purpose of establishing an arbitrary class distinction. Now, there's something to be said about markedness [1]. If the majority of a speci…

Given that the OP has posted to say that it was a mistake and hence isn't "unmarked" as you put it, you've quite missed the point. Not all mistakes (and corrections) are evidence of some classist plot.

Re: A complete guide to TypeScript’s 'never' type

#48

Earlier quoted context omitted.

>Most of the grammatical "rules" we tend to be taught in primary and secondary school English courses were invented relatively recently, and they were created specifically for the purpose of establishing an arbitrary class distinction. That's a very hefty accusation. Do you have any proof that "they were created specifically for the purpose of establishing an arbitrary class distinction"? >Now, there's something to b…

> Do you have any proof that "they were created specifically for the purpose of establishing an arbitrary class distinction"? Apologies; you are correct that my assertion is overly strong. I should rather have said "although we can no longer ascertain for certain the purpose for which these rules were introduced, some believe the origin to be rooted in a desire for creating an arbitrary class distinction." Many of th…

> But "poor grammar" specifically seeks to attribute a negative connotation to the utterance. It says suggest that people who construct such utterances are, somehow, uneducated, or else are outsiders. It says that they've done something that is objectively (not subjectively) incorrect or wrong.

You're completely ignoring that people do make mistakes and get corrected. There is nothing in the post you originally replied to implying that anyone is uneducated or an outsider - you're introducing that. "Poor grammar", "bad grammar" and "incorrect grammar" are interchangeable and aren't about class.

If I accidentally type "Eat I bread", it's incorrect grammar even if there happens to be some dialect somewhere where it is valid.

Re: A complete guide to TypeScript’s 'never' type

#49
post #30
post #28

Earlier quoted context omitted.

FYI: Neither 'tu es' nor 'tu aies' make any sense to me (disclaimer: I have only learnt Spanish on the street). https://www.spanishdict.com/conjugate/ser Perhaps you were trying to write down what you heard? 99% of the time there is a single canonical translation from verbal to written and vice-versa; English speakers have trouble learning that for some reason.

Sorry, I should have provided context. This was French, not Spanish. (I've clarified it in the original comment.) If it had been Spanish, transcribing it would be easier. French mooshes a lot of things together, so that "es" and "aies" are both pronounced "eh".

I think it is generally polite when editing to add something to show you edited it. Especially when you significantly change details, or if the change is due to a comment, otherwise the thread looks like nonsense.

Re: A complete guide to TypeScript’s 'never' type

#50

As long as you're stuck with null and undefined, you might as well throw in never for $3 billion! "My favorite is always the billion dollar mistake of having null in the language. And since JavaScript has both null and undefined, it's the two billion dollar mistake." -Anders Hejlsberg "It is by far the most problematic part of language design. And it's a single value that -- ha ha ha ha -- that if only that wasn't th…

This `never` type is the opposite of a null value, though. The "billion dollar mistake" (which is really the absence of non-nullable references, not merely the presence of null or undefined) adds a possible value to every reference. At any point you could have a valid reference, or a null reference, and this makes it impossible to express the type of a reference which must be valid. The `never` type by contrast has no possible values. It offers a way to statically assert that nothing has been left unhandled.

A type system without `never` (or equivalent) is like a number system without zero. (Literally—`never` is the zero for algebraic data types.)

Post reply on HN