Mercerenies / tfactor

0 stars 0 forks source link

Visibility Modifiers #2

Open Mercerenies opened 4 years ago

Mercerenies commented 4 years ago

Currently, every function, module, trait, or functor you write is public. We need some sort of visibility modification to be able to write "private" code that stays hidden from the outside world.

I would like the default to remain "public", as (especially in a purely functional language like this) it is very often the intended visibility. On the other hand, you may explicitly mark any resource (read: anything that falls within ReaderValue) as private. A private resource can only be referenced from within the same module or any nested module contained therein. A private resource also doesn't count when checking whether a trait is satisfied, either for require declarations or for arguments to functors.

Note that this (probably) excludes visibility from nested functors, since they would have to be instantiated somewhere else, and their visibility permissions are going to be dependent upon the instantiation site, not the definition site. But I'm not certain about this yet.