4 ms·
I like Perl, and find the complaints about sigils weak given how many people swear by POSIX scripting, when there are so many better tools out there like Perl.
by jonathankoren 6y ago
I like Perl, and find the complaints about sigils weak given how many people swear by POSIX scripting, when there are so many better tools out there like Perl.
However I also found Perl’s OO to be painful. I’d call it a cruel joke. I could never comfortably wrap my head around its implementation because it always felt like a horrible kludge on top of the module system. Is it a module? Is it a class? Is it an object? Are they normal functions? Are they class methods? Or are they member methods? The answer to all for these questions is a resounding yes! TIMTOWTDI bites us once again.
Perl is great for its primary use case of being the thinking person’s BASH, and it has the greatest regexp and stdio support for any language I’ve used, but I wouldn’t build anything OO with it.
- tyingq 6y agoI didn't mean to say that sigils were a general issue. Just that they made complex data structures (and thus, OO) more complex...and intimidating for newcomers. As for wrapping your head around Perl OO, really it's just bless(). Bless($thing,'namespace') says "this $thing is an object, in this namespace". You can make an object without adding a namespace beyond the default main namespace... Like: sub test {print "whee\n";} my $foo={}; bless($foo,'main'); $foo->test(); That will print out "whee". Because I "blessed" $foo into the main namespace, calling $foo->test() is calling the subroutine "test" in the main namespace, with '$foo' as the first argument. So OO in Perl is just mapping a namespace to a blessed reference via bless($ref,'namespace'). Then $ref->call($arg) runs the "namespace::call" sub, but as if you did namespace::call($ref,$arg).
- jonathankoren 6y agoYeah, they’re just void pointers. I think lack of syntactic support for nested data structures comes from its origin as a better bash script.