oli-lang / oli

Language specification and discussion
http://oli-lang.github.io
MIT License
5 stars 0 forks source link

Keyword that represents null/undefined/void #9

Open h2non opened 10 years ago

h2non commented 10 years ago

Proposal Just to define empty assignment blocks that points to nothing.... but it can generate a bit of FUD and confusion...

aalda commented 10 years ago

I'm not sure... The concept of void does not make sense to me without the presence of functions. Can you think of any examples?

h2non commented 10 years ago

Could be something like this:

block: void 

JSON equivalent to null primitive type:

"block": null 

By the way... another alternative could be nil like null, but more ruby-like :) Anywway I'm not too much convinced about the idea to introduce reserved alphanumeric keywords (except the end block terminator keyword)

h2non commented 10 years ago

Maybe introduce a symbol-based token representing unassigned or undefined would be a better choice and more unobstructive solution, following the language design principles...

Some possible not bright ideas:

block: !!
block: (nil)
aalda commented 10 years ago

That sounds better. What about this:

block:!

or

block::
h2non commented 10 years ago

First one rules!! :+1: I will add a new operator called AssignNot right now :-)

h2non commented 10 years ago

Additionally, after some reflexions, I think it could be practical to have a reserved keyword called nil that represented null or undefined.

I think this will be useful for serialization processes. The main inconvenience will be that this implies to reserve another keyword in the language, so at this time, there are only 2 alphabetic keyword reserved: end and nil

So.. Oli language should support the following expressions:

# assign not operator
hello!:
# nil keyword assignment
hello: nil
h2non commented 10 years ago

Finally approved the following expressions to be a part of the specification

# assign not operator
hello!:
# nil keyword assignment
hello: nil