On Thu, Jan 8, 2015 at 2:56 PM, Keean Schupke <[email protected]> wrote:

> Thinking more about this, it would be better to have some kind of
> enclosing namespace that hides 'count' from outside interference. Something
> like:
>
> namespace mine {
>     int count
>
> export:
>     int report() {
>         return count;
>     }
>
>     instance Ord int is
>         x < y = do
>             count <- count + 1
>             primative_int_less(x, y)
> }
>
> Something that isn't a class (which you have to initialise new instances
> of), but is just hiding the definition of count. This would remove concerns
> about count being global, and is a bit like an abstract-data-type in Ada.
>

Folks, this is *way* off the thread topic, and really not an issue that we
need to spend time on. Namespace and module boundaries matter, and name
visibility matters. This was merely a quick and dirty example of why we
shouldn't just think of instances as something we can lift into types.
That's *all* it was.

Yes, we can make that variable thread-local.

Yes, we can hide the name.


shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to