Hi Moritz, I need a constant static field in the class. I think the method aproach will do it.
Thanks & Regards, Emiliano > Date: Fri, 18 Dec 2015 13:29:44 +0100 > From: mor...@faui2k3.org > To: perl6-us...@perl.org > Subject: Re: Constants as members of a class > > Hi, > > On 12/18/2015 03:46 AM, TS xx wrote: > > Hello dear perl6 users, > > > > I was in the need of declaring a member variable as a constant integer. > > I don't understand this. If it's a constant, why does it need to be > member at all? A member is per-instance storage, which seems to be a > waste for a constant. > > Just do > > class MyClass { > method TheConstant { 42 } > } > > Then you can use it both on the class: > > say MyClass.TheConstant > > or on an instance: > > say MyClass.new.TheConstant > > > Cheers, > Moritz