Symbols
Jump to navigation
Jump to search
I would like symbols to be used as consistently as possible.
When considering symbol combinations it's worth noting:
- Repeated symbols have almost no cost (hence conventions like ++)
- Engaging and disengaging shift has a cost
- Physically close symbols have a low cost (_+, &*, ~!, :?)
Blocks
- []
- ()
- {}
- <>
- ::
- :;
- "" string
- ' '
- ``
- /* */ comment
- [[ ]]
A rune/char literal could be ' ' which is traditional or :: which is becoming more common with utf8. So tab would be :\t:
Arrows
- << >>
- <- ->
- <= =>
- <-- -->
- <== ==>
- <<-- -->>
- <~ ~>
- <---<< >>--->
Misc
These don't tend to have as consistent of use
- ~
- @
- #
- ?
- \
Separators
- ,
- .
- :
- ;
Binary Operators
- * multiply
- + Add, concat
- - Sub
- / divide
- ** exponent
- % mod
- ^ bit xor
- & bit and
- && logical and
- | bit or
- || logical or
- !& bit nand
- !| bit nor
- !^ bit xor
Unary Operators
- +
- -
- !
Comparators
- ==
- <
- =< traditionally it's <=, but I'd like to reserve the arrow operator
- >
- >=
- !=
Assignment
I liked this one
F : float = 3.141 F : float F := 3.141 F = 3.141
Where : indicates Type declaration and = is memory copy. Used together (walrus) they do both.
I also like the idea of a static assignment vs a dynamic one
Person : struct{
Name : string
Age : int
}
adam : Person = {Name = "Adam", Age = 35}
In this case : is always used to assign a static value and = to assign a dynamic one. This could be extended
adam : Person : {Name = "Adam", Age = 35}
admin :: adam