jamiebuilds / ghost-lang

:ghost: A friendly little language for you and me.
302 stars 10 forks source link

[Proposal] Make booleans symbols #34

Closed yordis closed 5 years ago

yordis commented 5 years ago

Since the language support symbols, maybe the best implementation of boolean is to be a symbol.

true == :true // # true
false == :false // # true

The implemention becomes simpler and cleaner in what a boolean value actually is.

Taking inspiraction from Elixir/Erlang

wesrer commented 5 years ago

@yordis - Can you briefly outline what you mean by 'simpler' or 'cleaner'? How is this implementation better than the addition of another basic data type?

yordis commented 5 years ago

simpler: since boolean are just symbols the underline implementation just symbols, remove the needs of another data structure in the underline implementation.

cleaner: since boolean are just symbols, understanding that a boolean is something that points to the same reference (symbols) in the underline implementation which it will remove the needs of over complicate the boolean implementation.

How is this implementation better than the addition of another basic data type?

Worth to mention that I am not saying that you should remove boolean data structure, what I am saying is that boolean is just a symbol but with the constraint of two values: true and false.

jamiebuilds commented 5 years ago

While I like some internal simplicity aspects of this, I'm afraid it's actually more complex for external consumers. The concepts of true or false are necessary and inherent in all programming. Reconceptualizing these as having an even higher type is confusing.

Aka, the result of a > b being a "symbol" which has a convention of meaning "true" is harder to explain than just saying, a > b is true.

I like the thought, but I'm going to pass on it