POV-Ray : Newsgroups : povray.advanced-users : the POV-ray SDL--similar to Java and/or Python? : Re: the POV-ray SDL--similar to Java and/or Python? Server Time
6 Oct 2024 13:07:34 EDT (-0400)
  Re: the POV-ray SDL--similar to Java and/or Python?  
From: Warp
Date: 12 Sep 2006 06:37:43
Message: <45068df7@news.povray.org>
Orchid XP v3 <voi### [at] devnull> wrote:
> The only "object oriented" thing about the SDL is that you create 
> "objects" with it - as in, things that you can see on the screen.

  The "objects" in POV-Ray have nothing to do with object-oriented
programming. The similarity in the name is just coincidence and is
not indicative in any way.
  Of course you made a pun there, but I just wanted to make sure that
nobody gets confused.

  There are basically three requirements for an OOP language:

1) Modules.
2) Inheritance.
3) Dynamic binding.

  In some OOP languages 2 and 3 are replaced with a delegation mechanism,
but basically it's almost the same thing (ie. doesn't make too much of a
difference in object-oriented design).

  The POV-Ray SDL lacks all 3 of those. (Well, ok, #include files could be
seen as *very* primitive modules, but just barely.)

  Modula is an excellent example of a programming language which has
(very advanced) modules but which is not an OOP language. Its modules
have public and private sections and you can make instances of these
modules in the exact same way as you can make instances of Java or C++
classes. This module mechanism resembles so much the classes of Java and
C++ that most people would erroneously call it an OOP language even
though technically it isn't.

  Besides modules, an OOP language needs inheritance and dynamic binding
mechanisms. This means that modules can have an "is-a" relationship and
that you can handle more concrete instances (iow. lower in the inheritance
hierarchy) with generic code designed for more abstract instances (iow.
upper in the inheritance hierarchy), which means that the exact same
code can handle different objects if they have a common base class.
Dynamic binding means that the objects can specialize (ie. reimplement)
functions of the base class, and these functions will be called instead
of the base class functions even in code which only handles objects of
the base class type.

> It would probably *be* useful if POV-Ray's SDL *was* OOP - but that is a
> debate that has been had many times, essentially without a consensus
> arrising.

  I don't think there even has been any question which requires some
consensus. Some people just resist change and don't want the current
SDL to be modified (even if the new one resembles it). Also some people
have the strange misconception that "supports feature X" means the same
as "you must learn to use feature X or you can't do anything at all".

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.