TodePond / DreamBerd

perfect programming language
https://dreamberd.computer
Other
11.56k stars 364 forks source link

Add `i**` syntax #732

Open frc4533-lincoln opened 3 months ago

frc4533-lincoln commented 3 months ago

The i++/++i and i--/--i syntax is pretty common for adding and subtracting 1, respectively. I'm disappointed with language designers. Has nobody thought of i**/**i syntax?

// Just look how useful it is:
var var i = 7!
print(i**!)! // => 7
print(**i!)! // => 7

I can't tell you how many times I've wanted to multiply an integer by one. I'm sick and tired of i = i * 1.

TodePond commented 3 months ago

this is a great idea

fulcanelly commented 2 months ago

@TodePond @frc4533-lincoln

what about // syntax ?

I find myself really tired lately of writing one or 1

it would be much more convenient if I would write just 2 // or 9 // instead

also as a shortcut for undefined since 0 // is 0 / 0 i.e undefined

guigui0246 commented 2 months ago

also as a shortcut for undefined since 0 // is 0 / 0 i.e undefined

@fulcanelly no because 0// is 0 / 1 and therefor 0 but you could do a const const const 0 / 1 = undefined to use 0// as a shortcut to undefined