-
Notifications
You must be signed in to change notification settings - Fork 33
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
Unicode operator support #555
Comments
If |
Keyword |
Some simpler and less controversial Unicode operators from #555
make it configurable so I can use whatever characters and emojis I want, it would be the best feature in Civet |
@orenelbaum Thoughts on what this would look like? I wonder if templates (#587) would be a good answer, if you could define your own symbols like so: template 🧪
try
template 💀
catch Normally templates can only appear in contexts where function calls can appear, though, so I'm not sure whether this would work without some special casing. Another option would be to specify simple string replacements, maybe like so: "civet 🧪='try ' 💀='catch '" But that seems pretty fragile especially when it comes to spacing. |
A few more symbols to consider
I second being able to use templates to define symbols, it would be quite funny to use some geometry in place of the type system keywords like
|
Some folks don't use ligatures, but still would like nice notation. Here are some operators that we could support in a simple transpilation sense:
≤
<=
≥
>=
≠
!=
≡
==
(I guess)≣
===
≢
!==
²
** 2
²³
** 23
(ideally)²⁺³
** (2+3)
(ideally)≔
:=
⁇
??
⩲
+=
(I guess)⧺
++
(I guess)‖
||
≪
<<
≫
>>
⋙
>>>
⊕
^
or^^
(maybe, common notation for XOR)¬
!
(maybe)∨
||
(maybe)∧
&&
(maybe)…
...
‥
..
≟
?=
⩻
<?
(instanceof shorthand)∈
is in
∉
is not in
▷
|>
→
->
⇒
=>
’s
's
“...”
'''...'''
(?)‘...’
'''...'''
Let me know if I missed any! There are some pretty interesting opportunities with shorthand like
∈
. APL here we come.Note: These Unicode characters are relative easy to type using a compose key. On Windows, I use WinCompose, which emulates a feature built into X-Windows (I believe).
This is somewhat related to the (unwritten) proposal to support emoji in identifiers — ideally translating e.g.
😊
tosmiling
or similar, for JS interop, though it might be easier to translate it to something like$1F60A
, to avoid a lookup table. It might be nice to "support" other mathematical operators like≹
as identifiers, so that users can define them viaoperator
. (Or maybe such Unicode operators are automatically infix, but need to be defined viafunction
oroperator
.)The text was updated successfully, but these errors were encountered: