POV-Ray : Newsgroups : povray.advanced-users : Classes/containers in sdl? : Re: Classes/containers in sdl? Server Time
28 Apr 2024 01:55:11 EDT (-0400)
  Re: Classes/containers in sdl?  
From: clipka
Date: 15 Nov 2016 22:10:52
Message: <582bce3c@news.povray.org>
Am 16.11.2016 um 01:49 schrieb [GDS|Entropy]:

> It has been a long time since I have delved into SDL and my slowly rusting
> mind could use a refresher on something.
> 
> Is it possible to create "objects" like classes or generally any named
> container having properties in SDL other than to use an array?

You indeed seem to be a bit out of touch with development ;)

As of recently, an official experimental branch exists that supports
more advanced data containers:

https://github.com/POV-Ray/povray/tree/feature/dictionary

https://github.com/POV-Ray/povray/releases/tag/v3.7.1-x.dictionary.8791118

Official experimental branch means that the intent is to add the feature
to official POV-Ray, but the syntax hasn't been finalized yet.

The branch adds a `dictionary` container type, which is essentially a
string-indexed variable-type array. As syntactic sugar, it also supports
dot-identifier notation:

    #declare Foo = dictionary;
    #declare Foo["Go Figure"] = 47;
    #declare Foo.Fnord = sphere { <0,0,0>, 2 };

For giggles, the branch also adds support for a new flavour of
one-dimensional integer-indexed array that can grow dynamically as needed.

Another for-giggles extension allowing to mix data of different types in
one and the same array (both fixed and dynamic size) also already exists
in one of my drawers.


More detailed information on the currently implemented syntax can be
found somewhere on these neswgroups, probably posted mid-september.


The next step would be to introduce some syntax to assign macros to
arbitrary (i.e. non-global) variables, ideally without actually
duplicating the macro; that would effectively turn the dictionary type
into a mechanism for object-oriented programming (using duck-typing).


Post a reply to this message

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