Forum OpenACS Development: Re: FYI: User message feature

Posted by Lars Pind on
One drawback of adding switches to ad_returnredirect: If you redirect to a URL that happens to start with a hyphen, it will break, unless you put "--" in front of it.

Is that something we need to be concerned with?


Posted by Andrew Piskorski on
Offhand, I doubt that URLs starting with "-" occur anywhere in OpenACS in practice.

But this is a good example of one of Tcl's minor but annoying warts. I tend to habitually use "--" everywhere I think it might work, until "Oops, got an error, oh yeah, this particular Tcl command doesn't accept the '--' option, take it out."

And once you define a proc with no option switches at all, it seems that for 100% backwards compatibility you must never add any switches ever. Actually, hm, I suppose you could kludge something into ad_returnredirect to check the number of arguments it received, and implicitly add the "--" if necessary. That means doing its own parsing rather than using ad_proc though, which is probably both not worth it and a bad idea. Instead, perhaps it would be worthwhile to extend ad_proc itself to optionally support some such feature?