On Tue, Jun 02, 2020 at 09:34:30PM +0300, Peter Pentchev wrote: > On Tue, Jun 02, 2020 at 11:41:31AM -0400, Parrot Raiser wrote: > > I suspect that "methods" were originally distinguished from > > "subroutines" because it made the rain-dance about the new cure for > > all civilisation's ills and the heartbreak of psoriasis, > > Object-Oriented Programming, look more impressive. After one has seen > > a few programming religions launched, the similarities blur the > > differences. Profundity through obscurity always helps the marketing, > > because it slows the recognition. > > That... is only if you look at methods purely from an imperative and > procedural programming perspective :) Once you start thinking about > message passing or events, things get a little weirder :)
...not to mention that methods do, of course, provide a level of abstraction that is difficult to achieve with unbound subroutines. I imagine that you use that every day in Raku programming, either with smart-matching (the ACCEPTS method is kind of useful there), or with checking whether lists or arrays are empty (the .Bool method is kind of useful there), or with outputting values in easy-to-read format (the .gist method is kind of useful there). All of these would be... kind of unwieldy to do with subroutines that are not bound to any object, but have to check what they are called at every step. > > Subroutines are blocks of code that can be used anywhere within a > > scope that may be global or local. Methods are a subset of subroutines > > that can only be used within a particular scope on particular kinds of > > things. > > ...or so it is in procedural languages, which have their orientation > towards procedures (another name for subroutines) encoded right there in > the designation :) > > But that's a wholly different topic, we've abused this thread's subject > too much already, so I'll stop now :) G'luck, Peter -- Peter Pentchev r...@ringlet.net r...@debian.org p...@storpool.com PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
signature.asc
Description: PGP signature