I agree that constants deserve a prominent place in Perl, as they offer
constaint which can be beneficial to programmers. Sometimes its nice to know
that I mistakenly tried to treat a static variable as dynamic.
I disagree with "const" as it's verbose; I'd rather see something like
$pi=|3.14128 or something similar.
I've noted a few messages here with statements like "it looks like C++" and
"I hated that in Pascal" and so on. If we restricted ourselves to constructs
not found in other languages, there would be no Perl as we know it today.
Larry freely admits he borrowed constructs and techniques from many
languages.
There are many logical reasons for and against the RFC's here, but saying
"it looks like c so it doesn't make it for me" is a weak argument at best.
-WQ
>From: Steve Simmons <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>CC: [EMAIL PROTECTED], Steve Simmons <[EMAIL PROTECTED]>, Larry Wall
><[EMAIL PROTECTED]>, Mike Pastore <[EMAIL PROTECTED]>, Jeremy
>Howard <[EMAIL PROTECTED]>
>Subject: Re: RFC 83 (v1) Make constants look like variables
>Date: Mon, 14 Aug 2000 12:57:14 -0400
>
>On Sat, Aug 12, 2000 at 06:18:08AM +1000, Damian Conway wrote:
>
> > Please, please, please, PLEASE, let us not replicate the debacle that is
> > C++'s const modifier!
>
>It doesn't feel like a debacle to me, it feels like it put the control
>in the programmers hands. Yes, the syntax is often unweildy -- but IMHO
>that's because when one marries the idea of constants to complex data
>structures and references, the world becomes an unweildy place.
>
>On the other hand, many of the uses of constants are better-satisfied
>by having hidden or inaccessible members. If constants were limited
>to `core' perl data types (scalars, lists, arrays and hashes) and
>*completely* freezing the data element, that'd be enough for me. I lust
>to be able to do things like
>
> if ( $HOME =~ /indiana/ ) {
> local $::PI : const = 3; do_trig();
> } else {
> local $::PI : const = 3.14159...; do_trig();
> }
>
>(I'm from Indiana and claim right to use that joke without being
>insulting). Constants are good, and I'm damned tired of fixing code like
>
> if ( $PI = 3 ) {
> # We're not in Kansas any more, Toto.
> }
>
>Constants have a place, and belong in perl.
>
>Now, one may argue that my suggestion was too flexible or too broad.
>But the initial proposal left an awful lot of gray areas. If my proposal
>is felt to be too unweildy, I don't have a problem with that. Let's
>either
>
> o decide where to draw the line, define it cleanly, and say
> that more complex usage is better done with objects; or
> o permit both complex constants and object-based manipulations
> on the practice that TMTOWTDI.
>
>I lean towards the latter (complex constants) myself, but wouldn't
>go off and storm the barricades to get it. On the other hand, I
>*would* campaign strongly for constant scalars, lists, arrays, hashes
>and refs. If the only way to get them meant `completely constant',
>ie, no addition or removal or members, no re-orderings, etc, that's
>fine -- composition of complex constants with complex vars would let
>one do most of what was suggested in my longer posting, and I'd be
>happy to say the odder features should be done via object methods.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com