Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Thoughts on "one function, flexible arguments"?

by LanX (Cardinal)
on Aug 30, 2019 at 22:13 UTC ( #11105330=note: print w/replies, xml ) Need Help??


in reply to Thoughts on "one function, flexible arguments"?

The real issue is kind of semipredicate problem, which is avoided in your special example but can't be in general.

So what happens if the first positional argument is a hash ref and not a string like in your case?

How can you tell that this ref doesn't represent a hash of named arguments?

If this happens you'd need to diverge from your interface standard and will confuse yourself and your users.

Better stick with a convention which doesn't need special cases.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re: Thoughts on "one function, flexible arguments"?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2020-11-27 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?