While working on void
and later true
and false
I realized I would like to make those names reserved, despite the fact they are not keywords. It seemed odd — I made an arbitrary decision because void
was so ubiquitous. Or because it was placed in global namespace? It was so lame, definition of void
looked like any other object, and yet out of the blue it was selected by me that it should be reserved name. What if another object happens to be that important, should I also hard code its name into compiler to make it reserved as well?
Or was it global namespace indeed? And that was all it mattered?
There are plenty of languages which allow you to put a function, a variable into a global namespace with typical advice that you should keep global entities to minimum. Skila was one of those languages.
But not any longer, add as many variables to global namespace as you like.
Yes, sure, go ahead.
Just keep in mind shadowing of namespaces in Skila is disabled. It is a trick which solves my dilemmas about making arbitrary decision with names, and it also enforces the discipline of polluting the namespaces, no more talking, just rules. Take a look how it works:
namespace DirtyPlayground let x Int = 5; def func(x Int) // error ••• end end
The first x
effectively makes a reservation for its name for entire namespace (and its descendants), thus you cannot shadow it by declaring any local variable.