41
ThePalimpsestformalmodelpreciselydescribesaparticularsetoffundamentalsequence
operationsandmergestrategies.Thisformalmodelisonesolutiondrawnfromacomplex
designspace;itisbasedonbothpracticalconsiderationsandlogicalconstraints.Becauseof
themanyinteractionsofthebasicdatamodelwithuserinterface,systemsinfrastructure
anduserexpectations,theapplicationproblem(evenforoneapplication)almostcertainly
hasnosingleanalyticallydeterminedsolution;itratherallowsonlyvaryingcompromises
amongconflictingrequirements.WhilePalimpsestapplicationprogrammerscanbe(andare)
offeredsomechoiceintermsofstrategiesforoperationconflictresolution,adata-oriented,
declarativeapproachrequiresaclearlydefinedbaselevelsemantics(whichmaynotbeto-
tallyindependentofpolicy)andwhichformsthefoundationonwhichaparticularsystem
canbebuilt.
2.2 Datatypesandoperationtypes
Ifoperationsaretobethefundamentalentitiesincontrollingconcurrentaccessanded-
itingofadatastructure,twofactorsareofprimaryimportance.Theexactdatastructure
beingsharedisonecriticalfactor.Anotheristheinteractionofchangeswhentheyarecom-
binedintohistories.Finally,thestructureofhistoriesaffectsthedefinitionsofoperations
andtheirpreciseinteractions.Whilethesefactorsareconceptuallyindependent,specific
decisionsonanyofthesedimensionsinteractwiththepossibledecisionsonotherdimen-
sions.Furthermore,evenfortheextendablesequence,thedatatypeforwhichIwillconsider
arelativelyfullrangeofpossibilities,theappropriatenessofparticularhistorystructuresand
interactionsmayvarydependingonthespecificapplication,becauseofdiffering,equally
sensible,possiblemethodsofresolvingconflicts.Palimpsestmakesasfewpolicydecisionsas
possible,whileensuringthattextualauthoringisaccommodatedbytheresultingsystem.
Perhapstheprimaryfactorindeterminingthesetofoperationsforadatastructureisthe
datastructureitself.Iwillconsiderdatastructuresasalgebraicdatatypesinthestyleofa
42
functionallanguagelikeML(Milner,Tofteetal.1990;MilnerandTofte1991)oranalgebraic
specificationlanguage(Bergstra,Heeringetal.1989).Forthegenerallevelofdiscussionin
thischapterweshallnotneedaformaldefinitionofdatatype,beyondthegenericnotionof
structureddatathatmustsatisfysomeadditionalconstraints.Weshallgenerallyignorethe
distinctionbetweentypesandtypeconstructors,andthetypesweshallconsider,likese-
quence,orcell,areinfacttypeconstructors(fortypeslikesequenceofintegers,string-
containingcell,etc.).Typeconstructorsareverygeneral,andcorrespondcloselytothe
kindsofgeneric“container”objectsusedinmanyobject-orienteddesigns.Thisgenericity
accountsforthefocusontypeconstructors,sincetheycoveraverywiderangeofpotential
application.Whiletherearemanyexamplesofinterestingtype-specificoperationsweshall
notconsidertheseinanydetailhere.
Thesimplesttypeofdataobjectisasinglecellthatcanholdsomeparticularvaluegiven
somehistory.Therearetwosortsofoperationthatcanbedefinedonsuchanobject.Ifthe
typeofthecontaineddataisignored,onlyachange-valueoperationmakessenseonacell.
Ifthetypeofthecontaineddataisknown,type-specificoperationsmightapply.Forexam-
ple,anintegercouldbesubjectedtoarithmeticoperationsthatupdateitsvalue,e.g.,incre-
ment,add20,ordouble.Astringmightbesubjectedtooperationslikechangecase,append
text,orstringreplacement.Palimpsestdoesnotaddressthequestionofrepresentingsuch
operations,thoughsomeextensionmightbepossible.
Onceweleavethecellbehind,wemoveintothebroaderrealmofcompositedatastruc-
turesingeneral.Thinkofacompositestructureasasetofcellswithaccessfunctions(possi-
blyaugmentedwithextraargumentstoserveasaddresseswithinthecomposite).Anaccess
functionreturnseitheranotherstructure,orthecontentsofaparticularcell.Astructure
mayconstraintherelationshipsofcellsinarbitraryways.Forinstance,anarraymighthave
afixednumberofcells,accessibleonlybyfunctionsthattakeaddressesintheformofnum-
berswithinafixedrange.
Previous Page Next Page