![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^2: What if Perl had an OO standard library?by awncorp (Acolyte) |
on Aug 24, 2022 at 03:51 UTC ( [id://11146352]=note: print w/replies, xml ) | Need Help?? |
I'm very tempted to agree with you "wholesale" given that I've been doing Perl since the mid-late 90s and through many many many bouts of trial and error have learned how to write well-reasoned succinct very Perlish code. However, I recognize that I'm only able to do so because of the amount of time I put into learning the language, and all of my failures along the way. People (other than us) needing to use Perl, who may not have the time or interest in learning "the ways of the force", who may be coming from other (typically OO) languages, would be much more comfortable in Perl if they could find corollaries to the idioms they already know. Some examples: In JavaScript: ['a', 'b', 'c'].forEach(item => console.log(item.toUpperCase())); In Ruby: ['a', 'b', 'c'].each(|item| puts item.upcase); In Perl: print uc("$_"), "\n" for ('a', 'b', 'c'); In Venus: Venus::Array->new(['a', 'b', 'c'])->call('map', 'say', 'uppercase'); In Venus: Venus::Array->new(['a', 'b', 'c'])->map(sub{ print uc $_, "\n" })
In Section
Meditations
|
|