TodePond / DreamBerd

perfect programming language
https://dreamberd.computer
Other
11.02k stars 341 forks source link

Less precise comparison #398

Open lasbec opened 10 months ago

lasbec commented 10 months ago

The single equal sign is a great feature to compare two objects. But I'm would like less precise comparison. To explain the sematics: The comparison itself could be less precise, but i'd suggest instead the result of the comparison should be less precise. So a comparison will always return maybe

I think about how the operator should look like. Maybe it should be a SQL-like, negated 'not equals' : ;<>

Or we could do the intuitive way of leaving a = sign for less comparsion:

const const pi = 3.14!
print(3.14 ==== pi)! //false
print(3.14 === pi)!  //true
print(3.14 == pi)!   //true
print(3.14 = pi)!    //true
print(3.14 pi)!      //maybe
mybearworld commented 10 months ago

Like the last idea, as it would simplify code golfing in DreamBerd 2.

lasbec commented 10 months ago

I was thinking weather it was possible to make the precision generic. To do so it needs the possibility to write less than zero equality signs. If a line could be marked with the number of equality signs it contains, the possibility would be given:

const const pi = 3.14!
print(3.14 ==== pi)! //false
print(3.14 === pi)!  //true
print(3.14 == pi)!   //true
print(3.14 = pi)!    //true
print(3.14 pi)!      //maybe
[expect 1 =]
print(3.14 pi)!      // 0.5
[expect 2 =]
print(3.14 pi)!      // "I really don't know"
[expect 3 =]
print(3.14 pi)!      // class

The less precise a comparison get's the less precise the results are. E.g. giving a keyword like class to a yes-or-no question is not very precise.

But I just don't know how to give less and less precise answers in a scaling way.

I don't know the use case of such feature jet, but leaving it out could be confusing to well trained programmers who are expecting concepts to be general.