Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2020-07-21
08:11 • Closed ticket [0b7f66f817]: dukomentation plus 6 other changes artifact: 7464c81708 user: jan.nijtmans
07:35 • New ticket [0b7f66f817]. artifact: faee9f88dc user: aotto1968

dukomentation

Closed / Out of Date0b7f66f817096167993fb631cd7473266955d20aCreated 6 years agoUpdated 6 years ago
Descriptionplain2020-07-21 07:35:43
man Tcl_NewMethod

Tcl_NewMethod(interp, class, nameObj, isPublic, methodTypePtr, clientData)

int isPublic (in)                   A flag saying what the visibility of the method is. The only supported public values of this flag are 0 for a non-exported method, and 1 for an exported method.

generic/tclOOMethod.c

line 206: Tcl_NewMethod...
int flags,                  /* Whether this is a public method. */

line 252:
    if (flags) {
        mPtr->flags |= flags & (PUBLIC_METHOD | PRIVATE_METHOD);
    }

line 368:
/*  
 * Bits for the 'flags' field of the call chain.
 */ 
    
#define PUBLIC_METHOD     0x01  /* This is a public (exported) method. */
#define PRIVATE_METHOD    0x02  /* This is a private (class's direct instances
                                 * only) method. */
jan.nijtmanswiki2020-07-21 08:11:06

Well: "The only supported public values of this flag are .."

So, this means that the PRIVATE_METHOD flag value is not supported for Tcl 8.6. That doesn't mean it cannot be used, you'r just on your own if you do that.

In Tcl 8.7, those flags are supported:

$ man Tcl_NewMethod
int flags (in)                      A  flag  saying  (currently)  what  the  visibility  of  the  method  is.  The  supported  public  values  of this flag are
                                           TCL_OO_METHOD_PUBLIC (which is fixed at 1 for backward compatibility)  for  an  exported  method,  TCL_OO_METHOD_UNEXPORTED
                                           (which is fixed at 0 for backward compatibility) for a non-exported method, and TCL_OO_METHOD_PRIVATE for a private method. │

So, if you want to use this, try Tcl 8.7. I don't think it's wise to start supporting this on 8.6 and update the documentation, since the TIP adding this was only accepted for Tcl 8.7.

Log in (anonymous is fine) to add a comment.