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

Re: Metamodel parent and return values ...

Thread Previous
From:
Paul Procacci
Date:
October 30, 2020 17:41
Subject:
Re: Metamodel parent and return values ...
Message ID:
CAFbbPuj+DM-pBXb_k+39dGBbWkW8YVg3x-H-5Vfnvh5TSktaVw@mail.gmail.com
Well I feel dumb.  I haven't tried it yet, but that makes sense.  It's what
I get for working on this in the weeee hours of the morning.

Thanks,
Paul

On Fri, Oct 30, 2020 at 7:48 AM Timo Paulssen <timo@wakelift.de> wrote:

> 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


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