Universal Literals And Expectation Operator 📣
thbwd opened this issue · comments
thbwd commented
⭐️ Proposed change
List and dictionary literals will be able to work with any type that implements a special constructor in the next beta of 1.0. It has been a longstanding goal to update the literal syntax.
The propose syntax is:
🍿 1 2 3 🍆
🍿 🔤key🔤 ➡️ 1 🔤another🔤 ➡️ 2 🔤third🔤 ➡️ 3 🍆
The type that will be instantiated from the literal is determined using type inference.
📣 will be introduced as the expectation operator that allows to specify the type that shall be created from a literal. This will work for number literals (📣23 💧
) as well as list and dictionary literals. E.g. 📣 🍿 1 2 3 🍆 🥙
where 🥙 can be created from a list literal.