Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool2.mu.edu!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: Naming Conventions Message-ID: <60362@microsoft.UUCP> Date: 8 Jan 91 22:54:05 GMT References: <60352@microsoft.UUCP> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 132 A second, harder problem in naming conventions is how to choose the syntax and names to be used in protocols. Consider the "simple" problem of "setting" or "getting" a subpart of an object. Below I list a few of the design choices I have seen to implement these actions: Set part of a thing to something: thing.part = something; thing.part() = something; thing->part = something; thing->part() = something; thing.setPart(something); thing->setPart(something); thing.SetPart(something); thing->SetPart(something); thing.set_part(something); thing->set_part(something); thing.part.set(something); thing->part.set(something) thing->part->set(something); thing.part = *something; thing.part() = *something; thing->part = *something; thing->part() = *something; thing.setPart(*something); thing->setPart(*something); thing.SetPart(*something); thing->SetPart(*something); thing.set_part(*something); thing->set_part(*something); thing.part.set(*something); thing->part.set(*something) thing->part->set(*something); thing.part = &something; thing.part() = &something; thing->part = &something; thing->part() = &something; thing.setPart(&something); thing->setPart(&something); thing.SetPart(&something); thing->SetPart(&something); thing.set_part(&something); thing->set_part(&something); thing.part.set(&something); thing->part.set(&something) thing->part->set(&something); thing.part(something); thing.part(&something); thing.part(*something); thing->part(something); thing->part(&something); thing->part(*something); something = thing->QueryPart(); something = thing->PartQuery(); Get part of a thing: something = thing.part; something = thing.part(); something = thing->part; something = thing->part(); something = thing.getPart(); something = thing->getPart(); something = thing.GetPart(); something = thing->GetPart(); something = thing.get_part(); something = thing->get_part(); something = thing.part.get(); something - thing->part.get() something = thing->part->get(); something = *thing.part; something = *thing.part(); something = *thing->part; something = *thing->part(); something = *thing.getPart(); something = *thing->getPart(); something = *thing.GetPart(); something = *thing->GetPart(); something = *thing.get_part(); something = *thing->get_part(); something = *thing.part.get(); something = *thing->part.get() something = *thing->part->get(); something = &thing.part; something = &thing.part(); something = &thing->part; something = &thing->part(); something = &thing.getPart(); something = &thing->getPart(); something = &thing.GetPart(); something = &thing->GetPart(); something = &thing.get_part(); something = &thing->get_part(); something = &thing.part.get(); something = &thing->part.get() something = &thing->part->get(); something = thing.part(); something = &thing.part(); something = *thing.part(); something = thing->part(); something = &thing->part(); something = *thing->part(); thing.getPart(something); thing->getPart(something); thing.getPart(&something); thing->getPart(&something); thing.getPart(*something); thing->getPart(*something); ----- A humble partial suggestion to help restrict the variety of syntax choices possible in implementing standard library protocols: _Please_ don't use the get, set, nor let "noise words." ----- PS: my personal favorites [for what _that's_ worth] are: // to "set" a part thing.part(something); // to "get" a part something = thing.part();