| Ticket UUID: | 1871041 | ||
| Title: | additional optional callback for access checking | ||
| Type: | RFE | Created on: | 2008-01-14 12:25:59 |
| Submitter: | wiede | Assigned to: | dkf |
| Subsystem: | 35. TclOO Package | Severity: | Minor |
| Priority: | 6 | Last modified: | 2024-08-06 11:07:58 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | None | ||
| Description: | ||||
This request is just some thoughts I had for beeing able to speed up itcl-ng, so maybe the solution is completely different than I am suggesting. I have not yet implemented/tried the stuff described here. The access checking rules for itcl functions are as follows (from the Itcl source code): Itcl_CanAccess() Checks to see if a class member can be accessed from a particular namespace context. Public things can always be accessed. Protected things can be accessed if the "from" namespace appears in the inheritance hierarchy of the class namespace. Private things can be accessed only if the "from" namespace is the same as the class that contains them. Returns 1/0 indicating true/false. Itcl_CanAccessFunc() Checks to see if a member function with the specified protection level can be accessed from a particular namespace context. This follows the same rules enforced by Itcl_CanAccess, but adds one special case: If the function is a protected method, and if the current context is a base class that has the same method, then access is allowed. Returns 1/0 indicating true/false. As I don't think it makes sense to directly implement these rules in tclOOCall AddMethodToCallChain, I think it would be better to have an optional callback (on a per class base) to do the additional checking. This would help to avoid additional code and later checking when calling the function in itcl (as it is done at the moment) | ||||
| User Comments: | ||||
wiede added on 2008-10-16 14:12:44:
If TIP 333 is realised, then this feature request is no longer necessary. dkf added on 2024-08-06 11:07:58:
In general, TclOO works with stack frames rather than namespaces. In particular, the call context is bound to stack frames (in the Call chain construction is expensive as it involves a full walk of the inheritance graph for an object and its class. We really want to cache that if we can. (The call chain computed on a class is the stereotypical call chain, used on all instances that don't create instance methods, which is the normal case.) Call contexts bind an object to a call chain and a few other bits of tracking state, and are limited in scope to a stack. TclOO has grown private methods since this FRQ was added. It doesn't do "protected" right now (with unexported methods being things in the same sort of role, at least with respect to "an API for methods internal to this class hierarchy") but the place where all that machinery would inject would absolutely be in call chain construction. The key problem in adding a | ||||
