in reply to RE (5): Should I use $ and $# ?
in thread Should I use $ and $# ?

I personally see the language as being both precise and correct. The word "our" was reserved by Perl (though at that point not yet used) and using that reserved word as a bareword is deprecated. Which is exactly what it said.

I respectfully (though strongly) disagree. And I do respect your contribution above and many others of yours. So please try to not let the strength of my disagreement come across as a criticism of you.

The use of "our" is not depricated (as the message claimed). The use of "our" as a bareword is depricated. Other uses of "our" are being encouraged, though just not yet. Consider the two error messages:

Use of %s is deprecated Use of reserved word """"%s"""" is deprecated

They mean nearly the opposite (a feature is being added vs. a feature is going away), but sound nearly identical (in fact, you could correctly substitute the second for the first in most cases since the deprecated feature is usually still a reserved word!). The important parts of the latter (that it is being reserved for future use and that your use of it is being parsed as a bareword) are omitted. The term "reserved word" strongly implies that Perl considers "our" to be a keyword, while the important fact is that it isn't yet.

That error message is (only slightly) incorrect. But the error message is very, very misleading. Also, the message is so simple and easy to understand (though incorrectly) that I can't fault someone (much) for not thinking to go read perldiag.pod to see if, perhaps, the message actually means nearly the opposite of what it says.

Finally, the original use of "our" as a bareword was not based on a lack of knowledge of the fact that using all-lowercase barewords is a bad idea. It was based on the knowledge that "our" is a keyword in Perl, and a lack of knowledge of the fact that the version of Perl being used wasn't the a version that supported "our".

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
RE (7): Should I use $ and $# ?
by tilly (Archbishop) on Aug 12, 2000 at 09:37 UTC
    Please don't apologize for criticizing my opinion. There is no need - I have been on the receiving end of far worse!

    As to the message, it clearly does confuse a lot of people, why I don't know for sure. (The fact that there clearly is confusion means that there probably was a better way to word the error. Care to offer one?) Certainly I read it, and re-read it, and fail to see how it could mean anything other than what was intended. When I see the word "reserved" I don't think that means that it is in current use. Certainly that is not how it is used in daily life.

    When I reserve a plane ticket, I don't expect to immediately have a plane ride. Ditto when I reserve a hotel. And I frequently see parking lots with empty reserved spaces. So why when you see that Perl thinks that a word is reserved would you assume that it is actually in use?

    As for your claim that the messages mean opposite things, I respectfully and strongly do not agree. Both messages say that you are using a construct in a way that is now discouraged to make room for future changes. It is true that the actual change is different. One catches the keyword coming, one going. But in either case you are being warned that what used to work will work for now, but may break in any future release, so you should remove it from your code. Before it becomes a bug.

    As for the cause of the mistaken use of our, that is both interesting and yet another reason for learning to rely on your internal documentation rather than any source that may not match what you have installed. For instance if you use Camel 2 as a reference, that documents 5.003. (BTW it looks like the documentation on this site is also 5.003.) Camel 3 documents 5.6. Now in the new edition you will find both qr// and our. In the old you find neither. What will you find in 5.005? Well "perldoc -f qr" and "perldoc -f our" shows you that qr// exists and our does not.

    Get in the habit of consulting the installed documentation and you won't even try to use features that you saw being advertised because they showed up in a newer version than you actually have! :-)

    EDIT
    I wrote the above while tye was actually searching past archives of p5p for the actual discussions which produced the message in question. He turned up something different than I would have expected (it was my turn to assume I think:-), and I quite agree with his conclusion that the choice of "reserved" originally did mean "reserved for future use", accidentally became confusing, and there is a far better message that could have been used.

    I will let him post that though. :-)

      > (BTW it looks like the documentation on this site is also 5.003.)

      I know this is a small point to pick at, but it has been bugging me, and it has been brought up more than once. Our Head Honcho has put a lot of work into this site, and if you have ideas on how to improve it, by all means post something to the Perl Monks Discussion section. Updating the site documentation, for example, is a very good and very important idea - it's just a shame to see it buried deep inside a nested post as <disclaimer> what seems to me as </disclaimer> somewhat of a dig against the site.

        I am sorry I cannot respond to this in full. In 24 hours I need to be on the other side of the continent giving a talk and I don't have room for much else.

        But I was not trying to slam this site. No matter what this site does, it will be wrong for someone. I have seen people here using 5.004, 5.005, and 5.6. These are all different. You simply will not get a single reference, be it a book or a website, to conveniently document all of these in any straightforward way for people to use. Whether or not this documentation is updated, it is a mistake to encourage people to rely on it.

        Instead what I would love to see is to have every page taken from Perl's documentation have up top a disclaimer like this:

        This documentation may be for a different version of Perl than what you have.
        For more accurate documentation please type perldoc (whatever)
        Letting people know the problem and encouraging them to get the answer from the right place would IMNSHO do far more good than telling them to rely on this site and trying to be all things to all people.

        BTW you should see Tom Christiansen rant on this topic some time...

        I don't see how you could possibly read it as a dig against the site. The whole thrust of the argument was, don't use any documentation as absolute for your site, except that which was installed along with the version of perl that you have.

        "Updating" the documentation on the site even to 5.6 does not solve that problem since even then it still only applies to the people who have 5.6 installed.

        Regards

        Nuance