Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a was keyword #666

Open
kokoro-aya opened this issue Jun 24, 2024 · 1 comment
Open

Add a was keyword #666

kokoro-aya opened this issue Jun 24, 2024 · 1 comment

Comments

@kokoro-aya
Copy link

Some languages have is keyword for various purposes, for example, Python uses it to check the equality between objects and Kotlin uses it to verify if a value appears to a given type.

Considering the ability of time traveling in DreamBerd, maybe it's useful to introduce a variant like was, for example, to check something happened in the past? Similarly, a will be keyword could be exploited to do something in the future.

Some simple examples:

const var score = 5!
score++!
print(score was 5)! // true

addEventListener("click", () => score++)!
print(await (score will be 7))! // true
print(score )! //5

Meanwhile, other variants like were, wasn't, weren't, would or has been could also be considered for adding interesting features.

@jeme
Copy link

jeme commented Jul 2, 2024

Not sure I get the example entirely, what's with the await?
I get the idea behind checking if a variable would come into that state in the future, that would be nice.

So a better sample to me would be:

const var score = 5!
if(score will be 10) {
   print("You will win!");
}

That would be so useful for making programs:

if(error will be true) {
   print("You need to fix your program, back to it!");
}

Basically allowing you to keep working on your program until the above if is never entered, now you know your program is PERFECT! and will never fail!

It would also save us a ton of time as we now never has to write all those pesky tests and even worse, perform them... 😒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants