crelf Posted December 2, 2010 Report Share Posted December 2, 2010 No, not a touchy-feely post about love amongst mankind, but a philisopical question about access scope. I have two classes: Class1 (contains MethodA) and Class2 (contains MethodB). When I set MethodA's scope to community, and I want to put it on the block diagram of MethodB, I need to make MethodB friends with Class1. Why can't I just make MethodB friends with MethodA? Quote Link to comment
ShaunR Posted December 2, 2010 Report Share Posted December 2, 2010 (edited) No, not a touchy-feely post about love amongst mankind, but a philisopical question about access scope. I have two classes: Class1 (contains MethodA) and Class2 (contains MethodB). When I set MethodA's scope to community, and I want to put it on the block diagram of MethodB, I need to make MethodB friends with Class1. Why can't I just make MethodB friends with MethodA? Because classes aren't very friendly? I would imagine it's because a class is an entity and you access that entities data through methods and properties by exposing them to a greater or lesser extent (I think of it like a box with buttons and indicators on it). As such your interface boundary is the "class" so you are in fact saying that the Method B should be able to poke a couple of wires behind the buttons and indicators when all Method B can do is press the buttons and read the indicators. But then again. I usually over-simplify things there's probably a more technical explanation. Edited December 2, 2010 by ShaunR Quote Link to comment
Aristos Queue Posted December 2, 2010 Report Share Posted December 2, 2010 Because classes aren't very friendly? No. It's VIs that don't have friends.The library (this is not specific to classes) is the thing that defines the access scope of its contained items. The library has to know that an item is a friend to grant it access to the community scope. Granting a particular other VI access to a particular VI within the library is something we could have implemented, but fiddling around with that level of declaration is usually noise -- if a VI not in the library is closely bound enough to the library to need a friend relationship, then it frequently wants access to multiple community scoped VIs, and you've already said that you know this other VI well enough to trust it with general access. Quote Link to comment
jgcode Posted December 3, 2010 Report Share Posted December 3, 2010 No, not a touchy-feely post ...you know this other VI well enough to trust it with... So it was all touchy-feely then and about trust awhh..... Quote Link to comment
crelf Posted December 3, 2010 Author Report Share Posted December 3, 2010 The library has to know that an item is a friend to grant it access to the community scope. Granting a particular other VI access to a particular VI within the library is something we could have implemented, but fiddling around with that level of declaration is usually noise -- if a VI not in the library is closely bound enough to the library to need a friend relationship, then it frequently wants access to multiple community scoped VIs, and you've already said that you know this other VI well enough to trust it with general access. That's fair. So it was all touchy-feely then and about trust awhh..... Sounds like the progression of most relationships. Or is it the opposite? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.