Forum OpenACS Development: Re: db_multirow and db_foreach -unclobber

Collapse
Posted by Lars Pind on
A couple of quick observations from here:

1. I already have the code sitting in my local checkout. It took about 20 minutes to write. I just posted to ask if it would be useful to other people.

2. The problem can be solved by renaming variables, yes. But it's not quite as simple as you make it. Or, rather, the thing that annoys me is that you have to rename *either* your page variables (which are part of your page's public API), your table columns (which are part of your application's API), or the column names in the multirow (also part of your page's API).

I admit that it's not a terribly big problem, it was just something that bit me and annoyed me a couple too many times, so I figured I'd take 20 minutes to implement a simple solution.

/Lars

Collapse
Posted by Tom Jackson on

Lars, as everyone here is painfully aware of by now, I get annoyed by changes to the core API, and core philosophy. And one of the main reasons is that I feel, rightly or wrongly, that these changes can be introduced with the tinyiest of discussions over the shortest period of time. If you go away for a three day weekend, the decision has already been made.

Even though your 20 minute fix is backwards compatible, it still adds to the processing of every db_multirow call. When someone has to wade through that code to trace some bug, in the future, they will have to consider your addition. I'm also not sure why the -unclobber only works if you have a code_block block. Shouldn't it work regardless?

Why not a non-core change? I would suggest a save-restore package, that might take more than 20 minutes to write, but it would not affect the core, and you could re-use the code anywhere it might help.

Pesonally I feel it is the job of the page programmer to work out these naming conflicts. The tcl/adp page are one thing. In fact the entire set of code that is executed in response to a request is one thing. Ignoring this fact will lead to bugs which are hard to trace.

Maybe it has something to do with my name. Whenever I call someone up, even close friends, I introduce myself as 'Tom Jackson'. I realize that the name 'Tom' could mean many things to most of my friends; I want to make sure they understand the correct meaning. Some folks call me up and just start talking, as if they needed no name. I imagine these are Perl programmers of some sort.

The programmer writing a page has the most information and knowledge of what each variable means. Naming them appropriately is the best method of communicating and documenting this information.

Is the logger page you are working on going to become part of the newly released logger package?