Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Suggested warning

4 views
Skip to first unread message

Aaron Sherman

unread,
Nov 7, 2004, 12:40:45 PM11/7/04
to Perl6 Language List
I would like to suggest that we define:

multi sub *infix:+(...) {...}

Will always generate a warning (not just for C<infix:+>, but for any
operator) if used outside of a class definition or if used inside a
class definition where the current class does not appear in the list of
parameters.

That is, you get a warning if you try to overload the behavior of an
operator for everyone without limiting your change to the type you are
currently defining.

--
アロン <a...@ajs.com>

Larry Wall

unread,
Nov 7, 2004, 9:36:13 PM11/7/04
to Perl6 Language List
On Sun, Nov 07, 2004 at 12:40:45PM -0500, Aaron Sherman wrote:
: I would like to suggest that we define:

:
: multi sub *infix:+(...) {...}
:
: Will always generate a warning (not just for C<infix:+>, but for any
: operator) if used outside of a class definition or if used inside a
: class definition where the current class does not appear in the list of
: parameters.

I suspect that's overkill, and we shouldn't put in a warning until it's
proven to be a problem.

Besides, that'd warn on most of the built-ins. :-)

: That is, you get a warning if you try to overload the behavior of an


: operator for everyone without limiting your change to the type you are
: currently defining.

I also suspect that the presence of the * there already indicates
that the programmer isn't interested in the warning. Catching exact
collisions and ties still happens, so I'm not sure if we need more.

Larry

0 new messages