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; #
[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 figure
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) {
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?)
Ingo Blechschmidt wrote:
# Please add more ways :)
enum MEANING_OF_LIVE:(42);
my MEANING_OF_LIVE = 42; # But might be considered evil sigilless mode
--
TSa (Thomas Sandlaß)
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();#
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
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 firstly is rw