Perl-Apollo / Corinna

Corinna - Bring Modern OO to the Core of Perl
Artistic License 2.0
157 stars 19 forks source link

"Rationale" feedback #81

Closed bill-mcgonigle closed 2 years ago

bill-mcgonigle commented 2 years ago

I'm trying to follow your LRU cache example.

It's declared:

    has $cache    :handles(get) = Hash::Ordered->new;

and then the explanation says:

has $cache :handles(get) :builder;
method _build_cache () { Hash::Ordered->new }
...
"if someone calls ->get on this this class, attempt to delegate it to whatever we have in this slot. In this case, that's the value the :builder method returns, in this case, Hash::Ordered->new;

OK, so hold up. Is :builder a special object method type or a declared method name? Is _build_VARNAME a magic method name? Is this somehow implicitly constructed (because it's not declared in the example code)?

It's likely I missed something but, as #feedback, this wasn't clear to me how the sample code got to that explanation.

Ovid commented 2 years ago

Hi @bill-mcgonigle. That appears to be from the Rationale wiki page. At the top of that document it states:

Please see the main page of the repo for the actual RFC. As it states there:

Anything in the Wiki should be considered "rough drafts."

Documents in the wiki were used to reflect the decision of the Corinna team as the proposal was evolving and they should no longer be considered canonical. They're incomplete (as you've noticed) and are often wrong. I've left them up there because many people have linked to them.

Instead, I refer you to the full RFC and, in particular, the MVP which is actively being added to the Perl core now. Note that much of the MVP description will make little sense without the full RFC.

Ovid commented 2 years ago

As there's no follow-up, it appears that this is resolved.