<i>additional optional callback for access checking</i> status still Open with 6 other changes
by
.
D 2024-08-06T11:07:58.000
J closer nobody
J comment This\srequest\sis\sjust\ssome\sthoughts\sI\shad\sfor\sbeeing\sable\sto\sspeed\sup\sitcl-ng,\sso\smaybe\sthe\ssolution\sis\scompletely\sdifferent\sthan\sI\sam\ssuggesting.\sI\shave\snot\syet\simplemented/tried\sthe\sstuff\sdescribed\shere.\r\n\r\nThe\saccess\schecking\srules\sfor\sitcl\sfunctions\sare\sas\sfollows\s(from\sthe\sItcl\ssource\scode):\r\n\r\nItcl_CanAccess()\r\nChecks\sto\ssee\sif\sa\sclass\smember\scan\sbe\saccessed\sfrom\sa\sparticular\snamespace\scontext.\s\sPublic\sthings\scan\salways\sbe\saccessed.\s\sProtected\sthings\scan\sbe\saccessed\sif\sthe\s"from"\snamespace\sappears\sin\sthe\sinheritance\shierarchy\sof\sthe\sclass\snamespace.\s\sPrivate\sthings\scan\sbe\saccessed\sonly\sif\sthe\s"from"\snamespace\sis\sthe\ssame\sas\sthe\sclass\sthat\scontains\sthem.\r\n\r\nReturns\s1/0\sindicating\strue/false.\r\n\r\nItcl_CanAccessFunc()\r\n\r\nChecks\sto\ssee\sif\sa\smember\sfunction\swith\sthe\sspecified\sprotection\slevel\scan\sbe\saccessed\sfrom\sa\sparticular\snamespace\scontext.\s\sThis\sfollows\sthe\ssame\srules\senforced\sby\sItcl_CanAccess,\sbut\sadds\sone\sspecial\scase:\s\sIf\sthe\sfunction\sis\sa\sprotected\smethod,\sand\sif\sthe\scurrent\scontext\sis\sa\sbase\sclass\sthat\shas\sthe\ssame\smethod,\sthen\saccess\sis\sallowed.\r\n\r\nReturns\s1/0\sindicating\strue/false.\r\n\r\n\r\nAs\sI\sdon't\sthink\sit\smakes\ssense\sto\sdirectly\simplement\sthese\srules\sin\stclOOCall\sAddMethodToCallChain,\sI\sthink\sit\swould\sbe\sbetter\sto\shave\san\soptional\scallback\s(on\sa\sper\sclass\sbase)\sto\sdo\sthe\sadditional\schecking.\r\n\r\nThis\swould\shelp\sto\savoid\sadditional\scode\sand\slater\schecking\swhen\scalling\sthe\sfunction\sin\sitcl\s(as\sit\sis\sdone\sat\sthe\smoment)
J icomment In\sgeneral,\sTclOO\sworks\swith\sstack\sframes\srather\sthan\snamespaces.\sIn\sparticular,\sthe\scall\scontext\sis\sbound\sto\sstack\sframes\s(in\sthe\s`clientData`\sfield,\swith\sa\sflag\sset\sto\sstate\sthat\sthis\sis\swhat's\sbeen\sdone).\sThis\sis\swhy\syou\s*have\sto\sbe\saccurate*\swith\swhat\sstack\sframe\syou\scall\sthings\sfrom\s(with\s`uplevel`\sand\sso\son).\r\n\r\nCall\schain\sconstruction\sis\sexpensive\sas\sit\sinvolves\sa\sfull\swalk\sof\sthe\sinheritance\sgraph\sfor\san\sobject\sand\sits\sclass.\sWe\sreally\swant\sto\scache\sthat\sif\swe\scan.\s(The\scall\schain\scomputed\son\sa\sclass\sis\sthe\s_stereotypical_\scall\schain,\sused\son\sall\sinstances\sthat\sdon't\screate\sinstance\smethods,\swhich\sis\sthe\snormal\scase.)\sCall\scontexts\sbind\san\sobject\sto\sa\scall\schain\sand\sa\sfew\sother\sbits\sof\stracking\sstate,\sand\sare\slimited\sin\sscope\sto\sa\sstack.\r\n\r\nTclOO\shas\sgrown\sprivate\smethods\ssince\sthis\sFRQ\swas\sadded.\sIt\sdoesn't\sdo\s"protected"\sright\snow\s(with\sunexported\smethods\sbeing\sthings\sin\sthe\ssame\ssort\sof\srole,\sat\sleast\swith\srespect\sto\s"an\sAPI\sfor\smethods\sinternal\sto\sthis\sclass\shierarchy")\sbut\sthe\splace\swhere\sall\sthat\smachinery\swould\sinject\swould\sabsolutely\sbe\sin\scall\schain\sconstruction.\sThe\skey\sproblem\sin\sadding\sa\s`protected`\sscope\swould\sbe\sworking\sout\show\sto\scache\sthe\sstereotype\scall\schains\scorrectly\s(since\syou'd\sneed\sto\sanswer\s"is\sthis\scontext\sable\sto\ssee\sthis\stype\sof\scall\schain?"\sfairly\squickly).
J login dkf
J mimetype text/x-markdown
J severity Minor
K 1871041fffffffffffffffffffffffffffffffff
U dkf
Z 3a48e23cf73106bed210db951a5c9cd3