Deprecation Versus Novices: No One Wins


Have you ever read the documentation for Perl 5's wantarray? (It's perldoc -f wantarray.) I don't remember the first time I read it, but as far back as I can remember, it's said something like:

This function should have been named wantlist() instead.

The second edition of Programming Perl, published in 1996, says something similar.

At least fifteen years later, novices still get tripped up on the difference between arrays and lists. That's fifteen years of confusion and fifteen years of further entrenching the damage of having a core keyword with the wrong name, making the problem worse and the pain of fixing things worse.

(What would have been the problem of making an alias named wantlist and deprecating but not necessarily removing wantarray?)


Does not understanding the difference between arrays and lists really cause problems in practicable usage?

perlfaq4 gives a couple of examples but none that I've ever seen in real life. OK, maybe something like '$first = split(//, $string)'. I can see that being a common problem.

I've seen all of the examples in perlfaq4 in real life. That's why they are in perlfaq4.

I see "Why don't nested lists work?" all the time.

I might be slow this morning but I wonder why would a novice even need to know about the "wantarray" function? I am showing it in my advanced class but I am not sure I should encourage the use of it.

Anyway, if it is going to be replaced then wouldn't it be better to use one of the modules that provide you with greater detail of the context? IIRC you even mentioned them in Modern Perl.

Let me restate the sentiment a different way:

Let's say you believe and wish that your software project will become popular-- that someday you will have more than twice as many users as you have now.

You spot a bad design decision that would break backwards compatibility to change it. If you fix it, you may annoy and inconvenience nearly all of your current users. However, if you look forward to growth and new users, you will be inconveniencing and annoying the *majority* of your users may not fixing it. Further, you may be retarding growth by keeping warts in your software, since users who discover your software after the fix won't care that you broke backwards compatibility with a version you never used.

Soon you may find you are competing you with new projects that "started from scratch", but really they learned from your mistakes and left out the warts.

If users are willing to switch to completely new languages, don't you think they would be willing to switch to a new version of your software without the warts?

Modern Perl: The Book

cover image for Modern Perl: the book

The best Perl Programmers read Modern Perl: The Book.

sponsored by the How to Make a Smoothie guide



About this Entry

This page contains a single entry by chromatic published on June 1, 2011 1:23 PM.

Summer 2011 Conference Talks was the previous entry in this blog.

Autogenerated Test Stubs is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by the Perl programming language

what is programming?