After a while I forgot why I hated JavaScript class. Maybe I just hated the prototype chain. But the ability to write polymorphic code is important and post es6 class is still the best way to do it in JavaScript. Not the best polymorphic form but we don’t have good traits in Rust. Even Rust trait is not my favorite polymorphism. Wen say goodbye to JavaScript? I need to invent my own language for my next Nostr software to burry the old Web. New Web deserves a new language.
Discussion
What is polymorphic code ?
When 2 data in the code can be used at the same place for slightly different behaviors. For example, both man and woman are human, but their pee function are different. So man and woman can share most of the code except for pee.
I don’t know why I had this weird example lol
A Nostr example, social posts and DM are both notes, but DM are encrypted. They should share most code except for “show” function. The DM’s show needs to decrypt the content first while social post can be directed shown.