Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread Aristotle Pagaltzis
[Cc to perl6-language as I think this is of interest] [Oh, and please read the entire thing before responding to any one particular point. There are a number of arguments flowing from one another here. (I am guilty of being too quick with the Reply button myself, hence this friendly reminder.)]

Re: Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread Andy Armstrong
On 24 Feb 2008, at 15:00, Aristotle Pagaltzis wrote: Something like path { $app_base_dir / $conf_dir / $foo_cfg . $cfg_ext } I've wanted this often. I've also wanted a clean way to lexically supply a default target object. For example with HTML::Tiny you often write my $h =

Re: Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread Luke Palmer
On Sun, Feb 24, 2008 at 3:00 PM, Aristotle Pagaltzis [EMAIL PROTECTED] wrote: Something like path { $app_base_dir / $conf_dir / $foo_cfg . $cfg_ext } where the operators in that scope are overloaded irrespective of the types of the variables (be they plain scalar strings, instances

Re: Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread Larry Wall
On Sun, Feb 24, 2008 at 04:23:54PM +, Andy Armstrong wrote: I've wanted this often. I've also wanted a clean way to lexically supply a default target object. For example with HTML::Tiny you often write my $h = HTML::Tiny-new(); $h-body($h-head($h-title('FooPage')), $h-body(...)); I'd

Re: Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread Doug McNutt
At 17:30 + 2/24/08, Luke Palmer wrote: On Sun, Feb 24, 2008 at 3:00 PM, Aristotle Pagaltzis [EMAIL PROTECTED] wrote: And I read both very carefully and failed to understand most of it. I use perl for physics and engineering mostly because I forgot most of my FORTRAN long ago and perl works

Re: Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread Jonathan Lang
Aristotle Pagaltzis wrote: And this contradiction – that being able to declare sugar is good, but the way that languages have permitted that so far leads to insanity – is what sent me thinking along the lines that there has to be some way to make overloading sane. And we all know that

Re: Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread David Green
On 2008-Feb-24, at 2:28 pm, Jonathan Lang wrote: { use text; if $a 49 { say $a } } ...with the result being the same as Perl5's 'if $a gt 49 { say $a }' (so if $a equals '5', it says '5'). Am I following you? If so, I'm not seeing what's so exciting about the concept; The whole point