Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: Is it ok to mix functional and oo programming in one package?

by chromatic (Archbishop)
on Oct 18, 2007 at 20:21 UTC ( #645839=note: print w/replies, xml ) Need Help??


in reply to Re^3: Is it ok to mix functional and oo programming in one package?
in thread Is it ok to mix functional and oo programming in one package?

When it works, it is. The problem is that it doesn't always work. new Foo has two barewords, and whenever the Perl parser encounters barewords, it has to guess at what they are. Sometimes it has hints at what those barewords are (if it's encountered declarations of filehandles or subroutines) and it can guess correctly. Sometimes it doesn't have hints, because Perl embraces late binding.

Sometimes it has hints which contradict late binding altogether. There's where you run into problems, because you have to know exactly which hints matter and when the parser knows about them to diagnose and correct the problem.

Alternately, you could use a syntax which isn't ambiguous to the parser and has the benefit of clarifying what exactly happens (new not being a keyword in Perl as it is in some other languages with OO systems).

Replies are listed 'Best First'.
Re^5: Is it ok to mix functional and oo programming in one package?
by ikegami (Patriarch) on Nov 08, 2021 at 17:58 UTC

    I don't think there's any guessing. If there is, let me know so I can fix this.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-05-26 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (92 votes). Check out past polls.

    Notices?