[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

RE: __DIE__ and exception hooks



Hey, that's some really marvelous sarcasm you have there. You should take
your show on the road. In front of moving vehicles.

I have no opinion on 'overload' other than the strong impression that Larry
has no love for it & it might vanish in a heartbeat.

Are you struggling to say that overload solves these problems already, in
all of the cases of interest?

		-----Original Message-----
		From:	Martyn Pearce [mailto:m.pearce@inpharmatica.co.uk]
		Sent:	Wednesday, January 19, 2000 10:06 AM
		To:	Redford, John
		Cc:	'Pete Jordan'; Perl5 Porters
		Subject:	RE: __DIE__ and exception hooks


		Redford, John writes:
		| There is also a much better option. Better is the sense of
being a more
		| general solution to a broader set of problems.
		| 
		| Make it possible for objects and other reference types to
define their own
		| string representations.
		| 
		| I don't really care how this is done, it should be obvious
how useful and
		| sorely lacking it is. One idea is as follows:
		| 
		| For non-blessed references, pick a few more Perl
special-variables & let
		| people store code-refs in them, and use them for
conversion of simple
		| references to strings. Perhaps just use one variable &
force the author to
		| figure out if a ref is SCALAR, HASH, or what.
		| 
		| For objects, define 'PRINT' as a special function which
Perl calls to get a
		| printable string representation of an object, and define
(internally)
		| PRINT_ADDR as a method of all objects to get the string
that is returned
		| presently.

		Alternatively, we could consider some sort of general
mechanism to
		handle conversions such as to numeric, to string, etc., and
also to
		provide operator overloading.  It could work as a pragma,
and drop in to 
		the existingsystem without further ado.

		I suggest as a syntax, something like:

		use overload
		  '""'	=> 'to_string';

		where to_string could be a subr, or a string as above, which
is to be
		interpreted as a method.

		It could even have a manpage --- something like 'man
overload' ought to
		do the trick.  But to help people find this, we should put a
note in the 
		perlop manpage, too.

		Ilya, I think you're the man for this job.  Perhaps you
could look into
		it.

		Mx.


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]