I was porting over some code today and had an apostrophe moment. (You know… when lighting strikes your brain?)
In order to deprecate a function in your code, you can leave the function intact, but basically have it shout out that it is deprecated and exit.
Here’s an example from the PHP script I’m working on.
public function import_dumps_into_staging_tables(){
$this->logerror(__FUNCTION__ . " deprecated!");
return false;
...
}
This is great because it basically logs that the function is deprecated and leaves the function.
In the abstract, this concept made it clear to me how Rails sends their deprecation warnings first. And then how they could use this concept (in Ruby syntax of course) to fully deprecate a method, without it causing some “No Method” error.

0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
You must be logged in to post a comment.