POV-Ray : Newsgroups : povray.general : Feature requests iden() : Re: Feature requests iden() Server Time
8 Aug 2024 22:09:41 EDT (-0400)
  Re: Feature requests iden()  
From: Ron Parker
Date: 27 Nov 2000 23:16:36
Message: <slrn926cd7.j1j.ron.parker@fwi.com>
On Mon, 27 Nov 2000 21:27:25 -0500, Chris Huff wrote:
>I see...but a POV one would have to allow more than just scalars, but 
>also vectors, objects...what should the keys be? Should(could?) both 

Well, in Perl, a reference to an array or another hash is itself a scalar,
so you can put almost anything in as the value.  If the value is itself
a hash (reference) you even get the effect of a multidimensional hash.

>scalars and strings be allowed as keys? Or maybe keys should be used 
>like identifiers...

As long as we're dreaming, might as well allow the key to be a string, vector,
color, or scalar.  Allowing scalars gives everyone those growable and/or 
sparse arrays they were looking for, too, at the expense of a bit of speed 
and efficiency.

>// Adds an item or modifies an existing item...
>#declare AssocArray[NewIdent] = AssocArray[Ident2] + AssocArray[Ident1];

I like how Perl uses curly braces for hashes so it's obvious what's going on.
We use curly braces for far too many things in POV already, but it'd be nice
if we could find some syntax that doesn't look like arrays.

>Or this, farther from array syntax(which may be a good thing, since it 
>isn't the same thing) but makes more sense(to me):
>
>#declare AssocArray.NewIdent = AssocArray.Ident2 + AssocArray.Ident1;

But not like this.  This looks too much like an object syntax, and I want it
to be clear that the primary purpose of an associative array is as a key/value
dictionary.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

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