On Sat, Jan 8, 2022 at 11:12 AM Duke Normandin <dukeofp...@gmx.com> wrote:
>
> On Sat, 8 Jan 2022 10:58:53 +1100
> Chris Angelico <ros...@gmail.com> wrote:
>
> [snip]
>
> > > "animal my_dog = animal(); ?? It seems to me that this should be
> > > the cloning statement to create a particular object of the
> > > animal class?
> >
> > This is the combination of the previous two lines: declaring
> > my_dog and also constructing a dog.
>
> This was what confusing me. Makes sense now that I know the
> statement is a combo of the two preceding ones - like declaring and
> initialising a variable all one statement in some languages.
>
> [snip]
>
> Thanks for clearing that up. I also notice that class declarations
> are called "programs" - not to be confused with the "main" program
> to be executed. Is that a correct interpretation?  If a class is
> declared within a program, in Pike its a "program" within a
> program? :?

(Redirecting back to the list.)

It's a bit of history from LPC, and others would be better at
explaining than I am, but my understanding is that it derives from the
fact that your whole script is itself a class definition. In fact, you
can actually clone a program by its file name - there's a standard way
to cast a string to a program (or directly to an object), which loads
the script from disk and parses it.

object parsevdf = (object)"parsevdf.pike";

The file "parsevdf.pike" contains a program, by any definition of the
word. According to Pike, it contains the definition of a class - which
means that this class is a program.

ChrisA

Reply via email to