[Southampton-pm] A case for custom infix operators

Duncan Garland duncan.garland at ntlworld.com
Fri Mar 21 13:17:32 PDT 2014


http://search.cpan.org/~davecross/Number-Fraction-2.00/lib/Number/Fraction.p
m

 

Don't know if this is relevant, but Number::Fraction was conceived as a
demonstration of operator overloading.

 

From: Southampton-pm
[mailto:southampton-pm-bounces+duncan.garland=ntlworld.com at pm.org] On Behalf
Of James Raspass
Sent: 21 March 2014 20:12
To: southampton-pm at pm.org
Subject: [Southampton-pm] A case for custom infix operators

 

Inspired by this in Python - http://legacy.python.org/dev/peps/pep-0238

 

I wanted to see how easily an integer dividing operator could be added to
Perl.

 

This implementation is a bit of a hack. I'm sure Tim'll appreciate the
blessed scalar ref :P

 

What do people think? It would be nice to have first class support for
custom operators in Perl, there has been some discussion on P5P but it never
went anywhere -
http://www.nntp.perl.org/group/perl.perl5.porters/2013/08/msg205547.html

 

[jraspass at gibson ~]$ ./div.pl

3.33333333333333

3

3.33333333333333

3

3.33333333333333

3

3.33333333333333

3

 

PS we should really get an IRC channel :)

 

James

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/southampton-pm/attachments/20140321/82201497/attachment.html>


More information about the Southampton-pm mailing list