emojicode / emojicode

πŸ˜€πŸ˜œπŸ”‚ World’s only programming language that’s bursting with emojis

Home Page:https://emojicode.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change Generics Syntax

thbwd opened this issue Β· comments

commented

✏️ Proposed change

The syntax for generic argument/parameter lists must be changed. There are two options I have considered so far:

  • The list begins with 🐚 and ends with πŸ†.

    πŸ¨πŸšπŸ”‘πŸ†
    πŸ₯žπŸšπŸ”‘πŸ”‘πŸ”’πŸ†
    
  • The list begins with❇️ and ends with πŸ†.

    πŸ¨β‡οΈπŸ”‘πŸ†
    πŸ₯žβ‡οΈπŸ”‘πŸ”‘πŸ”’πŸ†
    

πŸ† is used for consistency with current list/dictionary literals and will be changed when their syntax is finalized.

πŸ€” Rationale

The current syntax is ambiguous:

πŸ‘›πŸšπŸπŸšπŸ”‘

Grammar-wise it is not clear here whether πŸšπŸ”‘ is an argument to πŸ‘› or an argument for 🐚🐍. This is impractical for parsing in certain situations as well as it can be confusing to the programmer. With the new syntax there is no ambiguity:

πŸ‘›πŸšπŸπŸ”‘πŸ†
πŸ’­ or (depending on what the above meant)
πŸ‘›πŸšπŸπŸšπŸ”‘πŸ†πŸ†

πŸ•ΊExample

Some more examples:

πŸ‡ 🐝🐚Key βšͺ️ Element βšͺοΈπŸ† πŸ‡
   πŸ’­ ...
πŸ‰
πŸ‡ πŸβ‡οΈKey βšͺ️ Element βšͺοΈπŸ† πŸ‡
  πŸ’­ ...
πŸ‰
❗️ ⏭ ➑️ 🍬🐝🐚Key ElementπŸ† πŸ‡
    ↩️ next
πŸ‰
❗️ ⏭ ➑️ πŸ¬πŸβ‡οΈKey ElementπŸ† πŸ‡
    ↩️ next
πŸ‰