On Fri, Jan 14, 2005 at 09:47:15AM +0000, Armin Rigo wrote: | In my opinion a user-defined class or interface mixes two notions: a | "concept" meaningful for the programmer that the instances | represent, and the "interface" provided to manipulate it. ... | This suggests that only concrete objects which are expected to | encode a *single* concept should be used for adaptation.
So, in this view of the world, the adapter from FileName to File _is_ appropriate, but the adapter from String to FileName isn't? def checkSecurity(filename: FileName): ... Hmm. I'd like to be able to pass in a String here, and use that String->FileName adapter. So, there isn't a problem yet; although String is vague in a sense, it doesn't hurt to specialize it in the context that I have in mind. def checkContent(file: File): ... look for well known viruses ... def checkSecurity(filename: FileName): ... look for nasty path information ... return checkContent(filename) Even this is _ok_ since the conceptual jump is specified by the programmer between the two stages. The problem happens when one does... checkContent("is-this-a-filename-or-is-this-content") This is where we run into issues. When an adapter which 'specializes' the content is used implicitly in a trasitive adaption chain. | Note that it may be useful to be able to register some adapaters | in "local" registeries instead of the single global one, to avoid | all kinds of unexpected global effects. Nice... Best, Clark -- Clark C. Evans Prometheus Research, LLC. http://www.prometheusresearch.com/ o office: +1.203.777.2550 ~/ , mobile: +1.203.444.0557 // (( Prometheus Research: Transforming Data Into Knowledge \\ , \/ - Research Exchange Database /\ - Survey & Assessment Technologies ` \ - Software Tools for Researchers ~ * _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com