TodePond / DreamBerd

perfect programming language
https://dreamberd.computer
Other
10.65k stars 305 forks source link

[Feature Request] Add inequality operators #573

Open notahackusator opened 4 months ago

notahackusator commented 4 months ago

I noticed the lack of an inequality operator (!= in most languages and !== in the second best programming language JavaScript) and thought it should be added to DreamBerd. DreamBerd's NOT operator is ; so most programmers coming from other languages would likely think that the inequality operators should look like this: == => ;= === => ;== ==== => ;===

This, however, creates a problem with the imprecise equality operator =, as it would require its corresponding inequality operator to be ; which does not imply checking for inequality. One possible solution would be to prefix all equality operators with a ; to make the inequality operators look like this: = => ;= == => ;== === => ;=== ==== => ;====

This too could be problematic as developers coming from other languages might get confused and type the wrong inequality operator. Therefore, I have come up with what I believe is the best possible solution: prefixing the equality operators with ;;; (NOT NOT NOT) which is equivalent to ; (NOT) and would not cause any confusion for new developers as such prefixes do not exist in other languages. My final proposed solution for inequality operators would look like this: = => ;;;= == => ;;;== === => ;;;=== ==== => ;;;====

Example code:

print(3.14 ;;;= 3)! //false
print(3.14 ;;;== 3)! //true
print(3.14 ;;;=== "3.14")! //true
const const pi = 3.14!
print(3.14 ;;;==== pi)! //true
print(pi ;;;==== pi)! //false