POV-Ray : Newsgroups : povray.documentation.inbuilt : Mixed-type arrays Server Time: 18 Jan 2019 01:58:02 GMT
  Mixed-type arrays (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: clipka
Subject: Mixed-type arrays
Date: 23 Sep 2018 17:53:56
Message: <5ba7d334$1@news.povray.org>
Contrary to earlier claims, intentions, the documentation already on the
Wiki, and my own clouded memory, the restriction that array elements
have to be of the same type has /not/ been removed.

While I could fix this, I have decided not to, as same-type arrays are
clearly the default use case, and it may actually be helpful to get an
early error message when accidently assigning a value of a mismatching
type to one element.

Instead, the behaviour will be changed as follows:


In an array declaration, the `array` keyword may be followed by the
`mixed` keyword. This declares the array as a /mixed-type array/,
allowing it to hold elements of different types.

Example:

    #declare Foo = array mixed[3];
    #declare Foo[0] = 42;
    #declare Foo[1] = "Fnord";
    #declare Foo[2] = sphere { <0,0,0>, 1 }


Post a reply to this message

From: Kenneth
Subject: Re: Mixed-type arrays
Date: 23 Sep 2018 19:00:01
Message: <web.5ba7e1d435b91261a47873e10@news.povray.org>
Great feature.

With which version number (or alpha/beta) did 'mixed' become usable? I must have
missed the earlier announcement(s).


Post a reply to this message

From: clipka
Subject: Re: Mixed-type arrays
Date: 23 Sep 2018 20:12:36
Message: <5ba7f3b4$1@news.povray.org>
Am 23.09.2018 um 20:56 schrieb Kenneth:
> Great feature.
> 
> With which version number (or alpha/beta) did 'mixed' become usable? I must have
> missed the earlier announcement(s).

Mixed-type arrays were /supposed/ to work ever since v3.7.1-beta.1
(without requiring the `mixed` keyword), but strangely enough nobody
seems to have actually tried it out.

It /does/ work (requiring `mixed`) since v3.8.0-alpha.9850723. (Which,
as you may notice, hasn't even been announced yet at the time I'm
writing this.)


Post a reply to this message

From: Jim Holsenback
Subject: Re: Mixed-type arrays
Date: 4 Oct 2018 11:09:51
Message: <5bb5f4ff$1@news.povray.org>
On 9/23/18 1:53 PM, clipka wrote:
> Contrary to earlier claims, intentions, the documentation already on the
> Wiki, and my own clouded memory, the restriction that array elements
> have to be of the same type has /not/ been removed.
> 
> While I could fix this, I have decided not to, as same-type arrays are
> clearly the default use case, and it may actually be helpful to get an
> early error message when accidently assigning a value of a mismatching
> type to one element.
> 
> Instead, the behaviour will be changed as follows:
> 
> 
> In an array declaration, the `array` keyword may be followed by the
> `mixed` keyword. This declares the array as a /mixed-type array/,
> allowing it to hold elements of different types.
> 
> Example:
> 
>      #declare Foo = array mixed[3];
>      #declare Foo[0] = 42;
>      #declare Foo[1] = "Fnord";
>      #declare Foo[2] = sphere { <0,0,0>, 1 }
> 

done: http://wiki.povray.org/content/Reference:Array


Post a reply to this message

From: clipka
Subject: Re: Mixed-type arrays
Date: 5 Oct 2018 17:32:38
Message: <5bb7a036$1@news.povray.org>
Am 04.10.2018 um 13:09 schrieb Jim Holsenback:

> done: http://wiki.povray.org/content/Reference:Array

Thanks.

As usual, I keep finding nits to pick.

New nits:

- The syntax isn't clean with respect to which square brackets (`[`,
`]`) are literal characters and which indicate optional items. Most
notably, `[ mixed ]` (an optional keyword) is currently written in just
the same style as `[ INT ]` (an integer surrounded by brackets).

To the best of my understanding, the convention is that an opening
square bracket followed by a blank or a closing square bracket preceded
by a blank is meant to indicate a literal square bracket, while an
opening (closing) square bracket followed (preceded) by anything else is
meant to indicate an optional item.

Thus, it should be `array[mixed][ INT ][[ INT ]]..` (or, maybe even
clearer yet, `array [mixed] [ INT ] [[ INT ]]..`).

- The sentence "Any attempt to reference an uninitialized element
results in an error." may be misunderstood to apply only when the
`mixed` keyword is used.

Old nits:

- The syntax of `DICTIONARY_ITEM` is broken w/r/t the first variant:
Besides the aforementioned bracket issue (here being just the other way
round), the syntax implies that the string must be a literal, while in
fact it can be an arbitrary string expression. So it should be something
along the lines of `[ STRING ] :` or `[ STRING_EXPRESSION ] :`.

- The syntax of ARRAY_DECLARATION does not yet reflect that the
dimensions may be omitted altogether (creating a 1-dimensional
dynamically-sized array), so it should actually be `array [mixed] [[ INT
]]..`.


While I'm at it, maybe we should overhaul the way we present the syntax
altogether; I've written up a few ideas in
http://wiki.povray.org/content/User:Clipka/Syntax, some of which should
be reasonably easy to write.

(Of course if we go that route, I wouldn't expect you to do the boring
part of the work, just to set up the necessary framework.)

BTW, is there no easy shortcut to writing `<code>` tags? It's being used
a lot in our docs and is tedious to write. In Markdown, one would simply
use backticks (`) around the code, for instance.


Post a reply to this message

From: clipka
Subject: Re: Mixed-type arrays
Date: 5 Oct 2018 17:42:17
Message: <5bb7a279$1@news.povray.org>
Am 05.10.2018 um 19:32 schrieb clipka:

> As usual, I keep finding nits to pick.

I was a bit too quick with my previous post; there's more:

New nit:

- The bullet list "New to version 3.8 points to also consider" still
simply claims that "Array alements no longer have to be all of the same
type"; I'd simply replace that entire bullet item with "Arrays declared
as `mixed` have a larger memory footprint, even if all elements are
actually of the same type." or something along that line.

Old nit:

- A lot of the bullets refer to dynamically-sized arrays; maybe it is
worth "bundling" them together as is done for the dictionary-related
bullet points.


Post a reply to this message

From: dick balaska
Subject: Re: Mixed-type arrays
Date: 5 Oct 2018 20:44:04
Message: <5bb7cd14$1@news.povray.org>
On 10/05/2018 01:32 PM, clipka wrote:

> 
> Thus, it should be `array[mixed][ INT ][[ INT ]]..` (or, maybe even
> clearer yet, `array [mixed] [ INT ] [[ INT ]]..`).
> 

Definitely need the space after array.  The top one I read as the token
is either 'array' or 'arraymixed' .


-- 
dik
Rendered 1024 of 921600 pixels (0%)


Post a reply to this message

From: Jim Holsenback
Subject: Re: Mixed-type arrays
Date: 6 Oct 2018 09:23:29
Message: <5bb87f11$1@news.povray.org>
On 10/5/18 1:32 PM, clipka wrote:
> Am 04.10.2018 um 13:09 schrieb Jim Holsenback:
> 
>> done: http://wiki.povray.org/content/Reference:Array
> 
> Thanks.
> 
> As usual, I keep finding nits to pick.

lord have mercy on me ... you've just got too much time on your hands. 
/somebody/ please give me a amen on this! i'm finding most of what you 
write is just so tedious ... takes me reading it 3 or 4 times before it 
finally sinks in. i see more value in proceeding with the release and 
tabling this /overhaul/ until a later date


Post a reply to this message

From: Stephen
Subject: Re: Mixed-type arrays
Date: 6 Oct 2018 10:19:15
Message: <5bb88c23$1@news.povray.org>
On 06/10/2018 10:23, Jim Holsenback wrote:
> On 10/5/18 1:32 PM, clipka wrote:
>> Am 04.10.2018 um 13:09 schrieb Jim Holsenback:
>>
>>> done: http://wiki.povray.org/content/Reference:Array
>>
>> Thanks.
>>
>> As usual, I keep finding nits to pick.
> 
> lord have mercy on me ... you've just got too much time on your hands. 
> /somebody/ please give me a amen on this! 


https://www.youtube.com/watch?v=GAhbLcSpdlw

;)


-- 

Regards
     Stephen


Post a reply to this message

From: Jim Holsenback
Subject: Re: Mixed-type arrays
Date: 6 Oct 2018 13:29:58
Message: <5bb8b8d6$1@news.povray.org>
On 10/6/18 6:19 AM, Stephen wrote:
> On 06/10/2018 10:23, Jim Holsenback wrote:
>> On 10/5/18 1:32 PM, clipka wrote:
>>> Am 04.10.2018 um 13:09 schrieb Jim Holsenback:
>>>
>>>> done: http://wiki.povray.org/content/Reference:Array
>>>
>>> Thanks.
>>>
>>> As usual, I keep finding nits to pick.
>>
>> lord have mercy on me ... you've just got too much time on your hands. 
>> /somebody/ please give me a amen on this! 
> 
> 
> https://www.youtube.com/watch?v=GAhbLcSpdlw
> 
> ;)
> 
> 
i was going to say holy crap (ok pun intended) instead ... i'm wondering 
what/if you'd have posted if i did. style points for what you /did/ post


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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