On 2020-10-19 06:24:18 -0000, Mladen Gogala via Python-list wrote:
> On Mon, 19 Oct 2020 02:44:25 +0000, Stefan Ram wrote:
> > Mladen Gogala <mgog...@yahoo.com> writes:
> >>In Perl, there are no classes. 
> > 
> >   If there are no classes in Perl, then what does
> > 
> > bless REF,CLASSNAME 
> > 
> >   do?
> 
> bless \$ref will make the given reference a reference to the class. And 
> classes is Perl
> are called "modules". However, Perl classes are not the classes in the  real 
> sense. There 
> is no inheritance.

That's wrong. Perl classes have inheritance, and they always have had it
since they were introduced in Perl 5.0 (in 1994).


> You can have a similar thing in C: it's called "struct", it can do
> similar things like Perl modules.

Nope. C structs are data structures. Perl modules are primarily a way to
structure code.


> But C isn't object oriented. Inheritance is an essential
> characteristic of object orientation.

You can have that even in C. One of my first major C programs (back in
the 1980s) was object-oriented (including inheritance). I didn't even
know what "object oriented" meant back then, but the library we used for
the GUI stuff used that style so it felt natural to extend it to
"application level" objects.

> There were attempts to turn Perl into OO language with Moose
> (https://metacpan.org/pod/Moose)

Moose just adds syntactic sugar. It may be easier to read (especially
for people used to other OO languages) and save a bit of typing, but it
doesn't add anything you couldn't do in plain Perl5.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to