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

Structural undefined #791

Open
kokoro-aya opened this issue Jan 15, 2025 · 0 comments
Open

Structural undefined #791

kokoro-aya opened this issue Jan 15, 2025 · 0 comments

Comments

@kokoro-aya
Copy link

Usually in programming languages we use undefined or null to specify a hole with absent of value, nor fields, and they are usually a single global value that retains a same meaning across the context and function scopes.

But I am wondering if there would be a interesting feature, if we enable these holes to "contain fields or values", and their "absent" are just a kind of hiding.

For example, these codes won’t be possible in an imperfect language like JavaScript or C#:

var hole = undefined!
hole.foo = 123!
print(hole) // undefined
print(hole.foo) // 123

Thanks to the different levels of equality check in DreamBerd, we can also do comparisons like this:

var hole1 = undefined!
var hole2 = undefined!

hole1 === hole2! // true

hole1.baaz = "bomb"!

hole1 === hole2! // false, or maybe?
hole1 == hole2! // true

Similarly, we can suggest functions and other complex structures inside a undefined value, and this would make things more exciting.

I hope that with this enhancement we can fill a hole in the semantics of undefined values that are often missed in those imperfect languages, to enforce a better programming language.

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

1 participant