4 ms·
Ok, so I wrote tons of Perl and am to this day a fan, but I don’t think one can call a blessed hash (or scalar for the fancy folks) an object _system_. It is f
by jqcoffey 6y ago
Ok, so I wrote tons of Perl and am to this day a fan, but I don’t think one can call a blessed hash (or scalar for the fancy folks) an object _system_.
It is flexible and fun and I do miss it.
True story: years of passing functions to other functions and map/greps made the switch to FP Scala (another language I fear will die) a lot easier!
- cutler 6y agoI've heard Python's object system isn't that different under the hood.
- phone8675309 6y agoYou even have the same boilerplate of the first argument to a class member function being the object itself.
- cutler 6y agoYes. I was thinking mainly of Perl's symbol table which I believe is also how OO is implemented in Python.
- daotoad 6y agoMy understanding was that Perl's OO system was directly inspired by Python's. I can't find a source on that though.
- jlokier 6y ago> I don’t think one can call a blessed hash (or scalar for the fancy folks) an object _system_. Perl first, then JavaScript. Did you know JavaScript classes are blessed hashes? They even take about the same amount of syntax. ("__proto__" vs "blessed", "prototype" vs "bless"). Old JavaScript made the blessing crude and obvious. Modern JavaScript lets you hide it in a "class" decleration. Which you can also do in Perl if you want (though you'll need to choose a module for this, and people generally prefer a different approach to dressing up objects in Perl.) There's still a blessed hash under the hood which you can see and kind of have to be aware of... in both languages.
- daotoad 6y agoPerl and JavaScript both give you a minimally specified set of tools you can use to build your own more advanced object system. IMO, that's why both languages have been able to be extended and adapt so much. If you look at tools like Moo and Moose in Perl and the different coding paradigms that evolved in JS before the "class" keyword was standardized, this is pretty clearly evident. JS has had the advantage of a standards committee pushing new language features aggressively. Perl has moved more slowly, keeping a majority of functionality in libraries.
- jqcoffey 6y ago> Did you know JavaScript classes are blessed hashes? > They even take about the same amount of syntax. ("__proto__" vs "blessed", "prototype" vs "bless"). omg, I totally forgot that (I left day-to-day JS use a good decade ago, sorry!).
- lmm 6y agoTraditional JavaScript has a notoriously poor object system yes. If those are the only two languages you know then I guess Perl's object system doesn't seem so bad, but that shouldn't be a defense of either language.
- Discombulator 6y agoVery similar story here; I barely write any Perl nowadays but am still very fond of it. I especially like the sigils - they serve in a way as a primitive type system and actually convey useful information when reading code. I suspect people who complain about them are the same who dislike strong typing. Interestingly, like you, nowadays I am very fond of Scala.