Prev: Build 32-bit Tcl 8.4 under Fedora 64-bit
Next: Regex for Twitter usernames: need to exclude e-mail addresses
From: Will Duquette on 5 Jul 2010 12:50 On Jul 5, 7:16 am, Will Duquette <w...(a)wjduquette.com> wrote: > On Jul 5, 5:58 am, keithv <kvet...(a)gmail.com> wrote: > > > > > > > On Jul 5, 8:46 am, Keith Nash <k...(a)citizenearth.com> wrote: > > > > Robert Heller wrote: > > > > 1) copy the source and modify it. > > > > 2) create a new snit::type and delegate everything (except the *method > > > > you want to change) to the one in the library, with a replacement *method. > > > > (3) Not as slick as (2), but quicker: > > > > (a) Execute the Snit definitions for the object that you want. > > > (b) Overwrite the definition of the method that you need to change. > > > > snit::method objectName methodName {arg1 arg2 ...} { > > > method body > > > > } > > > I like the "quicker". Will the above work for non-method > > procedure? Here's a code snippet: > > > snit::type map::slippy::fetcher { > > ... > > proc urlOf {tile} { > > ... > > } > > } > > > I have an instance of map::slippy::fetcher and I > > want to modify procedure urlOf to accommodate > > different url schemes. > > > Thanks, > > Keith > > Snit process reside in a namespace named after the type. So what > you'd do is this: > > proc map::slippy::fetcher::urlOf ... Whoops! That should have been "Snit procs" (I got a little unwanted help from my iPad.)
From: Andreas Kupries on 9 Jul 2010 01:10 keithv <kvetter(a)gmail.com> writes: > On Jul 5, 8:46 am, Keith Nash <k...(a)citizenearth.com> wrote: >> Robert Heller wrote: >> > 1) copy the source and modify it. >> > 2) create a new snit::type and delegate everything (except the *method >> > you want to change) to the one in the library, with a replacement *method. >> >> (3) Not as slick as (2), but quicker: >> >> (a) Execute the Snit definitions for the object that you want. >> (b) Overwrite the definition of the method that you need to change. >> >> snit::method objectName methodName {arg1 arg2 ...} { >> method body >> >> } > > I like the "quicker". Will the above work for non-method > procedure? Here's a code snippet: > > snit::type map::slippy::fetcher { > ... > proc urlOf {tile} { > ... > } > } > > I have an instance of map::slippy::fetcher and I > want to modify procedure urlOf to accommodate > different url schemes. So, I guess in a future revision of the fetcher it should support some callback to perform the url-of outsie of the fetcher ? -- So long, Andreas Kupries <akupries(a)shaw.ca> <http://www.purl.org/NET/akupries/> Developer @ <http://www.activestate.com/> -------------------------------------------------------------------------------
First
|
Prev
|
Pages: 1 2 Prev: Build 32-bit Tcl 8.4 under Fedora 64-bit Next: Regex for Twitter usernames: need to exclude e-mail addresses |