On 12/14/20 2:33 PM, ToddAndMargo via perl6-users wrote:
Hi All,

https://docs.raku.org/language/classtut

      "A tutorial about creating and using classes
      in Raku"

So far so good.

      "Raku has a rich built-in syntax for defining
      and using classes."

Uhhhh. Forgot something did we?  What is a "class"?


Next up:

      "A default constructor allows the setting of
      attributes for the created object:"

Uhhhh.  Forgot something else, did we?  What is
an "object"?


The "tutorial" leaves "class" and "object" up to
the reader to guess at from what looks like an
interesting example.


But, again forgetting things, The tutorial also
leaves the syntax up for guess work as well.  Not
described are "$.", "$!", ":$", ^$" what are they
and what are the rules for using them.

Next up:

      my $r = Rectangle.new(
           lower => Point.new(x => 0, y => 0),
           upper => Point.new(x => 10, y => 10));


Why are we using ".new"?

Why are we using the syntax for a hash (=>)?

And:
      $!upper.x

What is the rules and purpose for such?  Why
the "!" and why the "."?


I do realize the documentation is not meant for
beginners, but rather a refresher for advanced
users that do not need it, but this link definitely
said "tutorial" -- fifth word in.

Would some kind soul please fill in the missing
parts of the "tutorial" for me?

Many thanks,
-T


Okay, here are some Perl 5 definitions for PerlDocs:

https://perldoc.perl.org/perlglossary

class

A user-defined type, implemented in Perl via a package that provides (either directly or by inheritance) methods (that is, subroutines) to handle instances of the class (its objects). See also inheritance.


class method

A method whose invocant is a package name, not an object reference. A method associated with the class as a whole. Also see instance method.


object

An instance of a class. Something that “knows” what user-defined type (class) it is, and what it can do because of what class it is. Your program can request an object to do things, but the object gets to decide whether it wants to do them or not. Some objects are more accommodating than others.


Anyone want to add Raku modifications to the above?  I
like their "user-defined type" description.

I don't know what to make of "more accommodating than others".


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to