hi guys, another suggestion.

What do you think of:
the called side (functions, members, maybe classes) can specify its visibility down to the function level. (with some wildcard syntax)
this is enhancing the private public internal as seen in most languages.

The Eiffel language has something similar for classes.
that is, selective export, only these classes can view this function.
In the Eiffel language:
class ARRAYED_LIST  [ G ]  inherit
    ARRAY  [ G ]
         rename
            count  as capacity, item  as array_item, put as array_put
         export
            {NONE}  all
            {ANY} capacity
         end
('none' is the "null" class, 'any' is like object, meaning that all classes can see 'capacity' but everything else is private)

this idea can be extended to functions, and checked by the compiler.
for example, a member can declare that only the setter can change it.
same thing for a getter.
sometimes a dll has a lot of inter-related functionality inside, and you want a certain "internal" function to be visible, but only used by certain functions.

The general idea, is that in a large project, this helps maintainability.
In a glance, you can see and limit misbehavior, therefore easier control of the code, and a more stable basis to build on. when things are simple, it is possible to continue developing, when things get complex, every advancing step is sluggish and slower.

I know these suggestions are kind of exotic, I have a few more traditional ones.
Bye, Kobi
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to