[Bf-python] Clearing single scriptlink

Ken Hughes khughes at pacific.edu
Mon Mar 21 02:39:20 CET 2005


Stephen Swaney wrote:
> On Sun, Mar 20, 2005 at 04:24:14PM -0800, Ken Hughes wrote:
> 
>>Stephen Swaney wrote:
>>
>>>
>>>If you are passing a variable number of arguments,
>>>you probably want to do it as a list:
>>>
>>>clearScriptLinks( [ "script1", "script2", "script3" ] )
>>>
>>
>>This sounded cool, so I thought I'd try implementing it
>>(took maybe 1 1/2 hours).  But after starting to work on
>>it realized we need to define what it does a little more
>>thoroughly:
> 
> 
> Funny how details start to appear in a 'simple' problem, eh?
> 
> 
>>* what happens if a "script2" isn't linked?  Ignore it,
>>   throw an exception?
> 
> 
> I would ignore it.  Putting it in the  clear list implies
> that you don't want it linked.  If, when you are done,
> it is not linked, you should be golden.  Not an error.
> 
> 
>>* what if a script is linked more than once? can't think
>>   why someone would want to do this, but it's possible.
>>   Delete all occurances, just the first (or last)?
> 
> 
> Delete them all.  Death to ScriptLinks!  If we need
> some positional deleting behavior, we can always add it
> later.

OK, I'll implement it this way and upload some patches shortly.
One other thing which, looking at the code, we maybe should
consider: the documentation for clearScriptLinks() [in
for Object class, anyway] says it returns "0 if some internal
problem occurred or 1 if successful", which doesn't seem
very helpful.  I hate exceptions as much as the next guy
(well, hate *getting* them, anyway), but at least they're
diagnostic so I can try to figure out why it failed.

Ken




More information about the Bf-python mailing list