Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: A short whishlist of Perl5 improvements leaping to Perl7

by tobyink (Canon)
on Nov 24, 2020 at 12:05 UTC ( [id://11124127]=note: print w/replies, xml ) Need Help??


in reply to A short whishlist of Perl5 improvements leaping to Perl7

With your emphasis of the word "modern", you seem to be implying that variable declaration is old-fashioned and it is more modern to auto-declare them.

However, the opposite is true. Javascript introduced a strict mode in ECMAScript 5, with variable declarations required, and its use is increasingly being encouraged.

The various varieties of Visual Basic (VB.NET, VBA, etc) have "Option Explicit" which forces you to declare variables before using them. Microsoft's documentation for the language says "Setting Option Explicit to Off is generally not a good practice".

  • Comment on Re: A short whishlist of Perl5 improvements leaping to Perl7

Replies are listed 'Best First'.
Re^2: A short whishlist of Perl5 improvements leaping to Perl7
by kennethk (Abbot) on Nov 24, 2020 at 15:29 UTC
    Auto-declaration has a much older history than that. For example, Fortran 77 (and probably earlier) implicitly typed variables that were undeclared based upon their first letter. Woe to those who forgot implicit none at the start of every subroutine. I am honestly horrified that Guido thought that declaring variables was a Bad Thing. Larry should have known better too, but at least use strict; disables that behavior.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Perl probably inherited undeclared variables from Awk and shell, both of which create variables when they are set, in contrast to C, which requires all variables be declared with types.

        I agree with the origins; I just wish that Perl had rolled a no strict; into -e rather than providing no constraint on variables in proper scripts.

        #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11124127]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 15:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found