At 12:17 PM 4/7/2005, $Bill Luebkert wrote:
John Deighan wrote:

> That's all very useful information, but there's no mention of what takes
> precedence - this reset statement or a user function named "reset". Why
> would an obscure feature like this reset statement take precedence over a
> user-written function with the same name? The result will inevitably be
> that buggy code will be created. In my case, I provided data to my boss
> that was incorrect because the reset() function that I wrote wasn't being
> called. There's no way that I'm going to take the name of every function I
> ever write and search the Perl docs to see if it's a reserved name.

A good highlighting editor would have given you a clue (gvim for example
will highlight in brown all core functions).

I really think that this is the only genuinely useful suggestion I've heard. We've currently got hundreds of thousands of lines of code and I'd hate to have to count the number of functions (not to mention function calls) in our code. It's completely impracticle to expect us to add "main::" or "&" or "use subs" in all of this code. I doubt that anyone is going to be able to come up with a rule for which function names look "suspicious" and need to be investigated further. I also personally feel that code is more readable if functions names are simple and reflect their purpose, so I'm not going to add otherwise meaningless prefixes, which could never guarantee no name conflicts anyway.Now, I'm beginning to wonder about a lot of the functions I've written with meaningful names.


Adding a '&' or 'main::' in front of the name:
        &reset ($arg);
        main::reset ($arg);
should get your sub rather than the core function.

use subs qw(reset);         will also work as previously posted.

I suggest you read the perlsub man page for some background.

The syntax highlighting file in gvim has a pretty comprehensive list
of reserved words if you want a copy - or even better adopt it as
your editor (an emacs variant, if you prefer, should also be fine).

--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)



Scanned for Spam and Viruses.

_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to