develooper Front page | perl.perl6.users | Postings from August 2022

Re: Problems with defining a class

Thread Previous | Thread Next
From:
Ralph Mellor
Date:
August 24, 2022 15:48
Subject:
Re: Problems with defining a class
Message ID:
CAPLR5SeO6kgo=-1eypJuvs8V1ogNTNe=h8CS+DM9wnyR0yTYCQ@mail.gmail.com
cf https://github.com/rakudo/rakudo/issues/1985

On Wed, Aug 24, 2022 at 2:47 AM Kevin Pye <kjpraku@pye.id.au> wrote:
>
> Hi,
>
> The following fairly simple code works well:
>
>    class A {
>      has num $!a is required is built;
>     };
>
>   dd A.new(a => 1e0);
>
> producing "A.new(a => 1e0)".
>
> However, if we make a slight change:
>
>    class A {
>      has num $!a is required is built;
>     };
>
>   dd A.new(a => 0e0);
>
> (i.e. initialising to 0 instead of 1), we get
>
>    The attribute '$!a' is required, but you did not provide a value for it.
>    in block <unit> at test.raku line 5
>
> Any value except 0 seems to work fine.
>
> Am I doing something stupid, or is this a problem with rakudo?
>
> Kevin.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About