Re: How to implement both object->method and module::function interface?

[email protected] (Chaim Frenkel) 15 Aug 2000 10:14:36 -0400
Newsgroups perl.perl6.stdlib
Message-ID <[email protected]>
As much as I'm not for it, would

having

	sub foo :method {}		# In objects vtbl
and
	sub foo {}			# only if procedural call

being a valid construct and having perl dispatch appropriately, be
viable?

<chaim>

>>>>> "GB" == Graham Barr <[email protected]> writes:

GB> However, if for method calls the object is moved out into $ME (or whatever)
GB> then this could be an advantage to a dual API. For example

GB> sub i_dont_care_sur_or_method {
GB>   # just process @_, ignore $ME
GB> }

GB> sub dual_api {
GB>   my $me = ref($ME) ? $ME : $default_obj; # Pkg->dual_api is same as sub-call
GB>   # process
GB> }

GB> So I am hoping that we get the object removed from @_ into an predefined
GB> lexical so the sub can more easily determine how it was called with
GB> little expense.

-- 
Chaim Frenkel					     Nonlinear Knowledge, Inc.
[email protected]				               +1-718-236-0183