develooper Front page | perl.perl5.porters | Postings from March 2007

Re: [PATCH] Extend functionality of UNIVERSAL::DOES() so it handles additional roles, and works in subroutine form.

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
March 11, 2007 21:19
Subject:
Re: [PATCH] Extend functionality of UNIVERSAL::DOES() so it handles additional roles, and works in subroutine form.
Message ID:
20070312041939.1857.qmail@lists.develooper.com
chromatic schreef:
> demerphq:

>> I have fixed this problem by making UNIVERSAL::DOES($item,$role) when
>> used in subroutine form work in DWIM fashion. When $item is an
>> unblessed reference, then it delegates to UNIVERSAL::isa() via
>> subroutine call.
>
> I support the idea of making ->DOES() work on internal "types"
> (ARRAY, REGEX, CODE, etc), but I think this idea is wrong.

What exactly do you mean by "this idea"? Is it the wrong one that you
support?


> 1) ->DOES() is a method on purpose, for overridability purposes.
>
> 2) Things that are methods should look like methods -- not just for
> clarity of that feature's purpose, but to avoid confusion between
> other features.  For example, UNIVERSAL::isa() and UNIVERSAL::can()
> are still methods and not functions, and the documentation finally
> expresses that.  Adding yet
> another "is it a method or is it a function" confuses the issue yet
> again (and anyone who wants to maintain a whole pile of bug-free code
> that people using methods as functions carelessly in distributions
> such as Template Toolkit and DBI::Class is more than welcome).

I miss a verb with "that people" there.
"anyone who wants to maintain a whole pile of bug-free code
that people [created?] using methods as functions carelessly in
distributions
such as Template Toolkit and DBI::Class, is more than welcome"

> [...]
> I believe the right approach to making ->DOES() work on built-in
> types is through autobox.  An alternate approach is to add a does()
> built-in, like ref() but actually useful.

I believe so too.

-- 
Affijn, Ruud

"Gewoon is een tijger."


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