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

Re^2: Recap: The Future of Perl 5 (backwards comaptibility, RFC)

by LanX (Saint)
on Aug 31, 2018 at 19:00 UTC ( [id://1221472]=note: print w/replies, xml ) Need Help??


in reply to Re: Recap: The Future of Perl 5 (backwards comaptibility, RFC)
in thread Recap: The Future of Perl 5

> but also go by the Python convention to have a constructor sub called Point()

to elaborate further

this:

class Point: def __init__(self, x, y): self.x = x self.y = y def inverted(self): return Point(self.y,self.x)

could be translated to

class Point; sub INIT($X,$Y) { $$x = $X; $$y = $Y; # or $self->{y} = $Y; } sub inverted { return Point($$y,$$x) # or Point->new($$y,$$x) # or Point->new($self->{y},$self->{x}) # or Point($self->{y},$self->{x}) # ... TIMTOWTDI }

People comming from Python would instantly feel at home and little by little discover more elaborated possibilities by using :attributes.

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found