The stupid question is the question not asked | |
PerlMonks |
Re^2: What if Perl had an OO standard library?by awncorp (Acolyte) |
on Aug 24, 2022 at 00:18 UTC ( [id://11146349]=note: print w/replies, xml ) | Need Help?? |
No offense intended. The remark that "sustained object-orientation in Perl is difficult …" is just my own fancy way of saying that “treating everything as an object is difficult/manual in Perl”. Data will always enter your program in its raw primitive form, and while you can objectify it (bless it), the lack of a native type system means that your classes and methods can’t be certain of the type of data they’re being passed, which forces you into a position of defensive programming. Consider the following examples (you made a routine and you want to compare anything passed in) ... Note: smatchmatch is experimental and not recommended for production use sub compare_things { $_[0] ~~ $_[1] } example #1
example #2
example #3
example #4
example #5
example #6
example #7
example #8
"I am inevitable." - Thanos
In Section
Meditations
|
|