fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] dw_dev2013-01-11 04:47 pm
Entry tags:

Renaming Apache2::Request $r

I keep tripping over $r which is from DW::Request->get, and is a DW::Request object $r which is an actual Apache2::RequestRec object -- the two are used in similar contexts and often have similarly named methods, but then you'll run into a method which behaves a a bit differently from one to the other and spend two hours debugging a completely unrelated thing.

We're trying to move away from Apache2::RequestRec objects and converting them into DW::Request where needed. How about we rename the old $r to $apache_r, and keep the new $r the same, so it's obvious at a glance which is which?

ETA: I've gone ahead and done just that for https://github.com/dreamwidth/dw-free/pull/211
pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)

[personal profile] pauamma 2013-01-11 01:40 pm (UTC)(link)
If (as you appear to be saying) the end goal is to get rid of the Apache $r entirely (except in places where you have to, which I think means inside DW::Request and its subclasses and nowhere else), why not rename it to $deprecated_r instead?
mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)

[staff profile] mark 2013-01-11 08:14 pm (UTC)(link)
I'd rather $apache_r, since that's more descriptive. IMO.

+1 though.