Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: What's the point of this 'overload' idiom?

by stevieb (Canon)
on Dec 07, 2022 at 05:13 UTC ( #11148640=note: print w/replies, xml ) Need Help??


in reply to Re: What's the point of this 'overload' idiom?
in thread What's the point of this 'overload' idiom?

Overloading as a general concept is something you want very rarely, but is very useful when you do want it.

I really like that statement. Well put.

One area where overloading is highly desired is during unit testing. Although I'd classify it as 'overwriting' rather than overloading, the premise is the same. Make a function do something different than what the original does. For example, Mock::Sub does exactly this. Overriding functions during testing happens very often and is hugely useful.

  • Comment on Re^2: What's the point of this 'overload' idiom?

Replies are listed 'Best First'.
Re^3: What's the point of this 'overload' idiom?
by LanX (Sage) on Dec 07, 2022 at 14:25 UTC
    I might be wrong, but I think the technical terms for overwriting functions are I'd use overloading explicitly for perlops

    But this might be restricted to Perl lingo and different in other languages (the line between operators, built-ins and functions is blurred and depends on context)

    And I have to admit that I'm anal about terminology, a "maladie professionnelle" of studying math...

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

Re^3: What's the point of this 'overload' idiom?
by eyepopslikeamosquito (Bishop) on Dec 08, 2022 at 12:40 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148640]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2023-03-27 00:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?