Kipper-Lang / Kipper

The Kipper programming language for Browsers and Node.js 🦊✨ Made at HTL Leonding & JKU Linz
https://kipper-lang.org
GNU General Public License v3.0
26 stars 4 forks source link

[Feature] Implement `any` type which allows any value to be passed to it, but not the other way around #670

Closed Luna-Klatzer closed 1 month ago

Luna-Klatzer commented 1 month ago

Is there an existing proposal for this?

This feature does not exist in the latest version

Proposal

Implement any type which allows any value to be passed to it, but not the other way around. This means, unlike in TypeScript, casting any to another type will throw a compiler error if the compatibility is unknown. Since it requires knowing what the origin and destination types are, there will be compile-time checks in place to ensure type compatibility.

These checks should be done in the future using force as, matches or using typeof check to ensure the types are compatible with the operation.

Exact behaviour / changes you want

Luna-Klatzer commented 1 month ago

Implemented by #662.