develooper Front page | perl.perl6.users | Postings from October 2020

Re: Metamodel parent and return values ...

Thread Previous | Thread Next
From:
Timo Paulssen
Date:
October 30, 2020 11:48
Subject:
Re: Metamodel parent and return values ...
Message ID:
9aed4e99-f4b0-852e-e44f-94f66a109565@wakelift.de
On 30/10/2020 07:58, Paul Procacci wrote:
> Here is what I have ... trimmed.
>
> #################################################################
> use JSON::Pretty;
> use Staticish;
>
> unit class MyClass is Static;
>
> method client(::?CLASS:D: Str:D $service! --> MyClass)
> {
>         my %data := from-json %?RESOURCES{$service}.slurp;
>         my $type = Metamodel::ClassHOW.new_type(
>                 name => $service,
>                 ver => v0.0.1,
>                 auth => 'github:me'
>         );
>
>         $type.HOW.add_parent($type, 'MyClass');
>         $type.HOW.compose($type);
>         $type.new;
> }
> #################################################################


Hi Paul,

I think when you're passing a string to add_parent, you're actually 
setting the class Str as the parent. raku will not go looking for a 
class with that name. Instead, it expects you to pass the actual type 
object.

Hope that helps!
   - Timo

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