-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[RFC] Towards Non-Fungible Types #48513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Are these types open to manipulation like normal "fiat" JS types? For example, what would happen if I instantiated an object, and then some unscrupulous third party "manipulated" its |
There might be an uncountable number of types, but we can only define a countable quantity of them. They are still a lot, but this is a big step towards scarcity. |
I would like to buy |
I'm not sure, I hadn't put a lot of thought into what @craftytricksters like you might do with these. |
What if a right-clicker just copies and pastes my types? 😕 |
To make things more economically viable, owners of type |
Can we start calling type artists "tartists"? Who wouldn't want to be a tartist? 😉 |
Has the environmental impact of this proposal been considered? I've heard "proof of steak" is better for that, should we leave steaks on TS team members' desks with a note of which type we wish to claim? |
It should be noted that in order for types to be truly non-fungible, we first need to switch to nominal typing. Otherwise |
There's prior art here courtesy of @JoshuaKGoldberg: #29374 (comment) Essentially, leave cakes not steaks. 🎂 |
I've been waiting for this announcement:
Up until now I was only able to assume nobody else had ever stolen these types. |
Similar concept being considered over at csharplang: dotnet/csharplang#5976 |
I like this idea but how will this be enforced? I think if we use a trust model then the right clickers will just use our types without permission. Would it be feasible to connect TypeScript to the blockchain to verify that you can actually use the types you're attempting to? I think this would go a long way to protect the copyright of all tartists. |
A lot of you have raised the risk of right-clickers copying precious types. I will reach out to partners on our editor teams to see if we can fix this. I think if Visual Studio and Visual Studio Code lead the pack, we may be able to disable right-clicking in TypeScript files in all editors! Admittedly, I'm not that well-connected. To start small, does anyone have the phone number for the CEO of the nano editor corporation? |
You might have luck with |
Try 0118 999 881 999 119 7253. |
@MartinJohns I think now that you mention it, I've seen this number for their hotline. It's a long one, but luckily they have a catchy jingle! |
I have a concern about typeconomics. Wouldn’t it help the adoption to pay tartists per error than per use? (based on error length ofc) On another note, when is the Non-Fungible-Type Marketplace plugin coming to TS Playground? |
And to think, up until now I've just been busking |
Let's doubleclick it. |
I'd like to make a bid for |
To ensure artificial scarcity to keep the Non Fungible Types values high, we could introduce a form of proof of work - I would propose that the typescript compiler will support mining types, for registering a type TSC will first try to find a 32 bit nonce that would satisfy sha256(sha256(source of the type without spaces + nonce)). Integrating WebGPU in TypeScript could be helpful to do it in a reasonable amount of time and seems fair that a developer has to have a powerful GPU to compile typescript code. A new command line argument "tsc --nft file.ts" would be handy to have an interactive NFT registration experience. |
interface Monke {
get ugliness(): number;
eat(what: Banana): void;
beHappy(): never;
} original type do not steal |
I'm starting to suspect this was an April Fools' joke and not the future of TypeScript. Perhaps you meant to add the tag |
@fatcerberus I made my own interface Monke {
get ugliness(): number;
eat(banana: Banana): void;
beHappy(): never;
} plz no steel |
Thanks for the feedback everyone! I see a bright future for the We are looking into revoking Daniel's issue-filing permissions. |
🤣 |
For years TypeScript has strived to grow and support its community. We've seen some tremendous investment, innovation, creativity, and beauty from TypeScript developers.
But how will we ensure that creators of these innovative types are rewarded for their brilliance? How do we make sure people continue writing more beautiful types?
This question coincides with the advent of "WEB 3", a broader community shift which can be best explained by aggressively waving one's hands. Many fascinating ideas have come from the "WEB 3" world including NFTs - Non-Fungible Tokens, which are simply Tokens which caNnot be Funged.
This dovetails with another new concept which I would like to introduce today: Non-Fungible Types.
The Idea
Today we see the broader use of non-fungible tokens for breathtaking pictures of apes that look like they've just been laid off - the biggest explosion of art collection since pogs, Beanie Babies, Pokémon cards, and fidget spinners.
What a lot of people don't realize is that TypeScript code is art.
How do we figure?
Well, if you've ever heard the expression "ars longa, vita brevis" – Latin for "art is long, life is short" – then you almost immediately recalled a TypeScript type you saw in an error message. It really does seem obvious when you put it that way!
In fact, you have a wide variety, ranging from minimalist TypeScript art...
to surreal TypeScript art...
So TypeScript types are great candidates for NFTs! Users should be able to take NFTs of type declarations and annotations and build a thriving ecosystem of type system artisans.
Do individual types actually have value?
I've discussed this proposal with
my math friends from collegeexperts in the field who havekinda offhandedly postulated over chat appsassured me that thanks to Cantor's Diagonal Argument, there are an uncountably infinite number of types. So can we really induce shortage to ensure value for every type?Well growing up, I argued with my cantor all the time so I remain undeterred.
Thanks to the unfungibility of the types, the value comes from the convenience of the types! So imagine that you're writing a program that uses types like
string
,number
,boolean
,null
, orundefined
. As an upstanding citizen of the non-fungible-type community, you would need to get permission from the NFT owner(s) of these types. You could consult a chain of blocked accounts on Twitter to figure out who must own it, DM them, and ask them for permission to use these types, at which point they might charge a reasonable fee.Imagine not just appropriately compensating this artist, but also the sort of community building that this will enable!
Won't this mean I can't write programs for free?
Like we mentioned, there's plenty of types to go around! Want to say you take a
string
without paying to usestring
?Just use a structurally compatible type with an optional member of type
never
See? It's still free! Freedom is a state of mind!
What about primitives like
string
,number
, andboolean
? Who owns those?Currently I have the non-fungible-tokens for
string
,number
,boolean
,bigint
,null
, andundefined
. I also have{}
and the non-primitive typeobject
. As an early pioneer in this ground-breaking space, it only feels fair to lay an early claim to these.Someone else can use
symbol
. It's whatever.Who owns
never
andunknown
?I am gladly donating
never
andunknown
to @ahejlsberg so that I never have to explain them again.Who owns
any
?Technically someone on the core team does, but they seem to have lost access to their credentials and we don't want to tell you all who it was.
We recommend not using
any
until we can figure out how to access it again.Timeline
I would like to see this happen soon. The fact that we have only created this proposal as recent as April 1st, 2022 means that we are already at risk of falling behind. Now is the best time to act!
The text was updated successfully, but these errors were encountered: