Skip to content
Tcl Source Code Artifact [5462916069]
Login

Artifact [5462916069]

Artifact 54629160695311b4ca85e6267a8e76645e5498c7:

Ticket change [5462916069] - Ticket [3474460fffffffff|3474460fff] <i>targetObject should be optional for oo::copy</i> status still Open with 4 other changes by basilik99 on 2012-01-26 06:42:28.
D 2012-01-26T06:42:28
J icomment Hi,\n\nThanks\sfor\sthe\scorrection\sabout\s"variable"\sbeing\scopied.\n\nThe\srand\strick\scomes\sfrom\sa\shigher\sneed:\sI\shave\sa\shierarchy\sof\sclasses\sthat\sI\swant\sto\sserialize\sto\sa\sfile.\sSuppose\sthe\sfollowing\sclasses\s(baseclasses\sto\ssubclasses):\sA\s->\sB\s->\sC\s->\sD\s->\sE.\sA\sgiven\sobject\sof\stype\sE\swill\sbe\sserialized\swhen\sits\sWRITE\smethod\swill\sbe\scalled.\sEach\sclass\scan\swrite\sspecific\sinfo.\sBut\sall\sclasses\swill\swrite\sits\sclass\stype\sto\sthe\sserialization\soutput\sfile.\n\nI\swanted\sto\simplement\sanother\sclass,\sSTORABLE,\swhich\sjob\swould\sbe\sto\swrite\sthese\stypes\sto\sthe\sfile.\sWith\sintrospection,\sit\sis\seasy:\slook\sat\sthe\sclass\sname,\sgo\sget\sa\sglobal\sconstant\sof\sa\sname\ssimilar\sto\sit,\soutput\sthe\svalue\sof\sthat\sconstant.\sSo,\sI\swant\sthe\scall\sto\sthe\sWRITE\smethod\son\san\sobject\sof\stype\sE\sto\sgive\sthe\sfollowing\schain:\nE's\sWRITE\s->\sSTORABLE's\sWRITE\s->\sD's\sWRITE\s->\sSTORABLE's\swrite\s->\s...\s->\sSTORABLE's\sWRITE\s->\sA's\sWRITE.\n\n1)\sI\sfirst\stried\sto\sinsert\sSTORABLE\sas\sa\smixin\sin\sthe\shierarchy,\sbut\sSTORABLE\swas\saccepted\sonly\sonce\sfor\sthe\swhole\shierarchy\s(in\sthe\stop\ssuperclass)\sand\shence\sSTORABLE's\sWRITE\swas\scalled\sonly\sonce,\snot\s5\stimes.\sAlso,\sSTORABLE's\sWRITE\swas\scalled\sBEFORE\sthe\simplementation\sof\sthe\sclass\sit\sis\sapplied\sto:\sI\scould\swork\swith\sthis,\sbut\sit\sis\snot\swas\sI\sexpected\s(however,\sI\swas\snew\sto\smixins...).\n\n2)\sThe\sI\stried\susing\sSTORABLE\sas\sa\ssuperclass.\sAgain,\sall\ssuperclass\scommands\swere\signored\sexcept\sthe\sone\sin\sthe\stopmost\sclass.\sTo\sTclOO\sto\ssee\sits\sthe\ssame\sclass,\sI\smade\sa\scopy\sof\sSTORABLE\seach\stime\sI\sused\sit\sas\ssuperclass.\sAnd\sthat's\swhat\sexplains\sthe\soo::copy.\sThe\srand\sis\sonly\sbecause\sI\swanted\sa\sdifferent\sname\sfor\seach\sSTORABLE\sclass\scopies.\n\nThere\smay\sbe\sbetter\sways\sto\sachieve\smy\sgoal.\sSuggestions\sare\swelcome.\n\nThanks,\nÉtienne\n
J login basilik99
J mimetype text/plain
J username basilik99
K 3474460fffffffffffffffffffffffffffffffff
U basilik99
Z c9937e071f9184f7c095fa40f6f09fcd