Forum OpenACS Development: Re: db_multirow and db_foreach -unclobber

Posted by Peter Marklund on
Separating ad_page_contract vars into a namespace or an array sounds like a reasonable idea to me. The fact is that when you start to have long and complex pages with maybe a handful of db_multirows and loads of local variables and query variables things start to get messy and error prone.

I had the privilege of working in Munich with Hrvoje Niksic, the author of wget and a very talented programmer. As we were sifting through some old aD code (quite possibly written by Phil G himself) Hrvoje used to joke that hmm, I wonder if a variable with this name is set in this scope, I really have no idea, but it probably is, so I'll just try it... This anecdote to me illustrates the general need for increased variable space separation in the toolkit.

Finally I just want to point out that the issue of the query and property namespaces work in the same direction as the proposed change to make db_multirow well behaved and not clobber its callers environment. The query and property namespaces do not fully solve the clobbering problem though - a problem that needs separate attention.