Re: Declarations of constants

2005-05-31 Thread Damian Conway
Adam Kennedy wrote: Forgive my ignorance here, but for all of these different ways of doing constants, will they all optimize (including partial evaluation/currying) at compile/build/init/run-time? my $gravity is constant = 10; # One significant figure sub time_to_ground ($height, $accel) {

Re: Declarations of constants

2005-05-31 Thread Simon Cozens
[EMAIL PROTECTED] (Adam Kennedy) writes: > Forgive my ignorance here, but for all of these different ways of > doing constants, will they all optimize (including partial > evaluation/currying) at compile/build/init/run-time? Gosh, I hope not. > my $gravity is constant = 10; # One significant figu

Re: Declarations of constants

2005-05-31 Thread Adam Kennedy
Ingo Blechschmidt wrote: Hi, # Way 1 my $MEANING_OF_LIFE is constant = 42; Forgive my ignorance here, but for all of these different ways of doing constants, will they all optimize (including partial evaluation/currying) at compile/build/init/run-time? my $gravity is constant = 10; # O

Re: Declarations of constants

2005-05-27 Thread Ingo Blechschmidt
Hi, "TSa (Thomas Sandlaß)" wrote: > Ingo Blechschmidt wrote: >> Or did you simply forget the braces around 42? :) > > No, it was intented for seeing what the reactions will be :) :) > Just using &foo as unsigiled variable. This might need > > my &foo is rw; I don't think this will DWYW, as fi

Re: Declarations of constants

2005-05-27 Thread TSa (Thomas Sandlaß)
Ingo Blechschmidt wrote: is that allowed (as 42 is a Num (or an Int), not a Code)? I don't know, but guess not. Do (most of) the basic types morph themselves into Codes, when needed? I don't consider it type morphing. If your examples parse at all they will be dispatched as usual say 4

Re: Declarations of constants

2005-05-27 Thread Ingo Blechschmidt
Hi, "TSa (Thomas Sandlaß)" wrote: > my &MEANING_OF_LIVE = 42; # But might be considered evil sigilless > mode is that allowed (as 42 is a Num (or an Int), not a Code)? Do (most of) the basic types morph themselves into Codes, when needed? say 42();# 42? say "Perl"();

Re: Declarations of constants

2005-05-27 Thread TSa (Thomas Sandlaß)
Ingo Blechschmidt wrote: # Please add more ways :) enum ; my &MEANING_OF_LIVE = 42; # But might be considered evil sigilless mode -- TSa (Thomas Sandlaß)

Declarations of constants

2005-05-27 Thread Ingo Blechschmidt
Hi, # Way 1 my $MEANING_OF_LIFE is constant = 42; # Way 2 my &MEANING_OF_LIVE = -> () { 42 }; # or sub MEANING_OF_LIVE () { 42 } # Then one can use sigilless constants: say MEANING_OF_LIVE; # Way 3 (still possible?) use constant MEANING_OF_LIVE => 42; # Way 4 (evil?)