Many archaic programming languages have redundant operators. For example < and >, and + and - are clearly just opposites of each other. This suggests the possibility of generalising the concept, into an operator-inversion operator.
But we can go even further. I propose that the prefix negation operator ; should be fully generalised, to invert any language construct, not just values. This is to negation approximately as the proposed ~ operator (https://github.com/TodePond/DreamBerd/issues/129) is to approximation.
For example:
;> is equivalent to <
;const is equivalent to var
var var a ;= b! is equivalent to assigning anything other than b to a.
a ;= b is equivalent to ;(a = b)
f;(x) is equivalent to x(f)
;! does not end the line
;// does not start a comment
;{ print(42) } is a comment
;undefined is defined
;function is defined to not function (guaranteed incorrect behaviour)
Many archaic programming languages have redundant operators. For example
<
and>
, and+
and-
are clearly just opposites of each other. This suggests the possibility of generalising the concept, into an operator-inversion operator.But we can go even further. I propose that the prefix negation operator
;
should be fully generalised, to invert any language construct, not just values. This is to negation approximately as the proposed~
operator (https://github.com/TodePond/DreamBerd/issues/129) is to approximation.For example:
;>
is equivalent to<
;const
is equivalent tovar
var var a ;= b!
is equivalent to assigning anything other thanb
toa
.a ;= b
is equivalent to;(a = b)
f;(x)
is equivalent tox(f)
;!
does not end the line;//
does not start a comment;{ print(42) }
is a comment;undefined
is defined;function
is defined to not function (guaranteed incorrect behaviour);noop
does something (guaranteed behaviour)This could also fix existing issues for missing operators that are the inverse of other operators (
!=
https://github.com/TodePond/DreamBerd/issues/573,create
/restore
https://github.com/TodePond/DreamBerd/issues/181 https://github.com/TodePond/DreamBerd/issues/185,comefrom
https://github.com/TodePond/DreamBerd/issues/99#issuecomment-1579314768,nowait
https://github.com/TodePond/DreamBerd/issues/141,;"
https://github.com/TodePond/DreamBerd/issues/330#issuecomment-1686627568).This also has exciting implications for operator overloading (https://github.com/TodePond/DreamBerd/pull/133).