in reply to Re^3: Thoughts on new 'class' OO in upcoming perl
in thread Thoughts on new 'class' OO in upcoming perl

The same way you prevent people calling bless( \%params, $your_class ) directly. You don't/can't.

Replies are listed 'Best First'.
Re^5: Thoughts on new 'class' OO in upcoming perl
by dsheroh (Monsignor) on Mar 07, 2023 at 08:38 UTC
    Technically correct, but it ignores one little detail: Calling ->new is the normal, default way to create an object. Calling bless directly is not.

    There's quite a difference between expecting people to not instantiate an object in a way which 99% of classes consider to be an unsupported backdoor "here be dragons" approach (bless) and expecting them to not instantiate it in a way which 99% of classes consider to be the standard way to do it (calling the ->new method).