Thanks anyway

The new method is there just to state the example.

Date: Thu, 17 Dec 2015 22:58:32 -0500
Subject: Re: Constants as members of a class

Two things jump out at me. One is that I think you don't need that "new" 
method. Second -- yes, this is a very old interpreter. I unfortunately don't 
know about the twigil variable constant things.

On Thu, Dec 17, 2015 at 9:46 PM, TS xx <> wrote:

Hello dear perl6 users,

I was in the need of declaring a member variable as a constant integer. After 
many syntax tryouts I came to this one:

class MyClass {
    has int $.myConst;

    method new () {
        return self.bless();

    submethod BUILD () {
        constant $!myConst = 1;

    method showMyConst () {
        print $!myConst;

But I'm getting the followinf error message: "Twigil-Variable constants not yet 
implemented. Sorry."

The only place in the docs where I have found any reference to constants is in 
But it's not what I am looking for :/

So my questions are:
Is the syntax right and the thing isn't implemented yet?
Is the syntax (or the full concept) wrong?
Do I have and old interpreter (This is perl6 version 2015.02 built on MoarVM 
version 2015.02)?

Thanks to all.

Kind Regards,


Reply via email to