POV-Ray : Newsgroups : povray.general : #version directive Server Time
31 Oct 2024 19:02:02 EDT (-0400)
  #version directive (Message 11 to 17 of 17)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: clipka
Subject: Re: #version directive
Date: 8 Feb 2018 12:08:15
Message: <5a7c83ff$1@news.povray.org>
Am 08.02.2018 um 11:52 schrieb Kenneth:

> In other words, if I'm currently using a specific v3.7.1 beta, then
> 
> #version version
> is basically a 'shorthand' way of specifying
> 
> #version 3.71;
> 
> ?

Exactly.

> "...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
> error to use #version 3.71 or higher in a main scene file that does not start
> with a #version directive."
> 
> Maybe it's just me, but that sounds confusing. "#version 3.71" is in GREEN there
> (like the other keywords used in those paragraphs), but is it meant to be? I'm
> wondering if the sentence is actually trying to say something like this:
> 
> "...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
> error to run a scene file in v3.7.1 or higher that does not start with a
> #version directive."  ??

No. It literally means what it says.

You can also put it this way:

As of POV-Ray 3.7.1 or later, starting a scene file with anything other
than a `#version` statement is considered an outright error.

For backward compatibility, exceptions are made for scenes that do not
contain any `#version` directive in the main scene file at all, or where
all `#version` directives in the main scene file specify values lower
than 3.71.

For technical reasons, the error is raised at the first occurrence of a
`#version` directive with a value of 3.71 or higher in the main scene file.


> And continuing... (the forward slashes are mine):
> "If you do need to do some processing /before you decide/ on a version
> compatibility option, start your scene with the following construct:
>   #version version;
> 
> That could possibly be interpreted as meaning a 'real' #version number needs to
> be added later in the scene.

That would be a misinterpretation.


Post a reply to this message

From: clipka
Subject: Re: #version directive
Date: 8 Feb 2018 12:32:35
Message: <5a7c89b3@news.povray.org>
Am 08.02.2018 um 16:19 schrieb Bald Eagle:

> The thing to do would be to write a short SDL script that sends the value of
> version to the debug stream.
> Then do #version 3.5, do #version version again, and see what version equals.
> In that case, if version winds up being 3.5, then version is a "POV-Ray
> predefined variable", rather than a constant that reflects the version of the
> build.

As a matter of fact, `version` /is/ a keyword, not a constant nor a
predefined variable.

In general, when using the keyword in an expression, it evaluates to the
most recent `#version` statement, `+MV` command-line setting or
`Version` INI file setting.

As an exception, if used in a `#version` statement right at the start of
the scene, it evaluates to the actual software version.

> Perhaps there ought to be a secondary "software_version" or "current_version"
> constant that immutably reflects the software version.

That's problematic, because older versions wouldn't recognize that keyword.

Even if it was implemented in such a way that `#ifdef` could test
whether the value is supported, you'd have to end up using something like:

#ifdef(software_version)
  #version software_version;
#else
  #version 3.7;
#end

Note that such a construct would violate the "version statement first"
constraint, as the first statement would be an `#ifdef` instead.

With the special behaviour of `version` when used in the initial
`#version` statement, you can instead safely use:

    #version version;
    #declare software_version = version;

and go on from there.


Post a reply to this message

From: Bald Eagle
Subject: Re: #version directive
Date: 8 Feb 2018 14:30:00
Message: <web.5a7ca42dc5234a59c437ac910@news.povray.org>
#version version;

// THEN:

#ifdef(software_version)
  #version software_version;
#else
  #version 3.7;
#end


The idea being that you can always access the actual software version, even if
you haven't "stored" the value in another variable.

It sounds to me like #version MyVersion "overwrites" this value, and it is then
lost.

I'm also writing this from the perspective that there will big changes when 4.0
gets written from the ground up, and I gathered that the whole
backwards-compatibility thing might be scrapped at that point.


Post a reply to this message

From: Kenneth
Subject: Re: #version directive
Date: 9 Feb 2018 23:55:00
Message: <web.5a7e7a7dc5234a59a47873e10@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
>
> Also, this:
> "...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
> error to use #version 3.71 or higher in a main scene file that does not start
> with a #version directive."
>

Not to nitpick, but I'm still having trouble 'parsing' that sentence ;-)
The way I see it is like this (and using a bit of Clipka's clarifications):

1) The #version directive is now a requirement (actually since v3.7.0, I think.)
That's clear.

2) Starting with v3.7.1 (alpha, beta, whatever), it's now considered an outright
error to leave out a #version directive in a scene. That's clear too-- I
think(?)

3) but: "... to use #version 3.71 [which is in green in the docs, meaning the
#version directive in a scene] in a a main scene file that does not start with a
#version directive", is the troublesome part. It kind of sounds 'circular' or
not quite logical. But I think there are two ways of reading it:

       A) An OLD scene file (one that didn't use a #version directive to begin
with) would produce "an outright error" if #version 3.7.1 were added to it AND
the scene were to be run in v3.7.1  (I'm actually still not sure if this
intepretation is correct.)
       B) Assuming that v3.7.1 (or later) *is* the currently running version,
and the scene itself does have #version 3.7.1 in it, then the scene already HAS
a #version directive-- definitely not a situation where the scene "does not
start with a #version directive"(!)  In this intepretation of the sentence, it
doesn't make much too much sense (and this is the way I generally read it,
unfortunately... without some effort to second-guess its meaning).


Post a reply to this message

From: Thomas de Groot
Subject: Re: #version directive
Date: 10 Feb 2018 03:23:16
Message: <5a7eabf4$1@news.povray.org>
On 10-2-2018 5:52, Kenneth wrote:
> 3) but: "... to use #version 3.71 [which is in green in the docs, meaning the
> #version directive in a scene] in a a main scene file that does not start with a
> #version directive", is the troublesome part. It kind of sounds 'circular' or
> not quite logical. But I think there are two ways of reading it:
> 
>         A) An OLD scene file (one that didn't use a #version directive to begin
> with) would produce "an outright error" if #version 3.7.1 were added to it AND
> the scene were to be run in v3.7.1  (I'm actually still not sure if this
> intepretation is correct.)
>         B) Assuming that v3.7.1 (or later) *is* the currently running version,
> and the scene itself does have #version 3.7.1 in it, then the scene already HAS
> a #version directive-- definitely not a situation where the scene "does not
> start with a #version directive"(!)  In this intepretation of the sentence, it
> doesn't make much too much sense (and this is the way I generally read it,
> unfortunately... without some effort to second-guess its meaning).
> 
> 

I did a little test in version 3.7.1 as well as in UberPOV, with a scene 
from 2000. With or without #version 3.71; (or #version unofficial patch 
3.71;) as a first line, the scene renders with the following warning:

Parse warning: The scene finished parsing with a language version set to 
3.1 or earlier. Full backward compatibility with scenes requiring 
support for bugs in POV-Ray version 3.1 or earlier is not guaranteed. 
Please use POV-Ray 3.5 or earlier if your scene depends on rendering 
defects caused by these bugs.

Obviously, the resulting image has all kinds of defects but I wanted to 
know if the scene would render at all. No fatal error, only a parse warning.

-- 
Thomas


Post a reply to this message

From: clipka
Subject: Re: #version directive
Date: 10 Feb 2018 05:52:57
Message: <5a7ecf09$1@news.povray.org>
Am 10.02.2018 um 05:52 schrieb Kenneth:
> "Kenneth" <kdw### [at] gmailcom> wrote:
>>
>> Also, this:
>> "...and a CHANGE as of POV-Ray 3.7.1 or later it is now considered an outright
>> error to use #version 3.71 or higher in a main scene file that does not start
>> with a #version directive."
>>
> 
> Not to nitpick, but I'm still having trouble 'parsing' that sentence ;-)
> The way I see it is like this (and using a bit of Clipka's clarifications):
> 
> 1) The #version directive is now a requirement (actually since v3.7.0, I think.)
> That's clear.

In v3.7.0, this "requirement" is not actually enforced. In v3.7.0, you
always get a warning if the scene does not begin with a `#version`
statement, but that's it.

> 3) but: "... to use #version 3.71 [which is in green in the docs, meaning the
> #version directive in a scene] in a a main scene file that does not start with a
> #version directive", is the troublesome part. It kind of sounds 'circular' or
> not quite logical. But I think there are two ways of reading it:
> 
>        A) An OLD scene file (one that didn't use a #version directive to begin
> with) would produce "an outright error" if #version 3.7.1 were added to it AND
> the scene were to be run in v3.7.1  (I'm actually still not sure if this
> intepretation is correct.)

Inserting `#version 3.71` would mark the "old" scene file as no longer
"old", but rather overhauled to work with v3.7.1.

>        B) Assuming that v3.7.1 (or later) *is* the currently running version,
> and the scene itself does have #version 3.7.1 in it, then the scene already HAS
> a #version directive-- definitely not a situation where the scene "does not
> start with a #version directive"(!)

That totally depends on where the `#version 3.71` directive is placed.

> In this intepretation of the sentence, it
> doesn't make much too much sense (and this is the way I generally read it,
> unfortunately... without some effort to second-guess its meaning).

Consider the following scene:

    // Just a comment
    global_settings { assumed_gamma 1.0 }
    #version 3.71;
    // ...

That scene file would raise an error, because it claims to be a scene
designed for v3.7.1 but doesn't comply with the requirement that the
scene must start with a `#version` directive. The scene should be
changed as follows:

    // Just a comment
    #version 3.71;
    global_settings { assumed_gamma 1.0 }
    // ...

The easiest way to enforce this would be to raise an error (rather than
warn, as was the case in v3.7.0) whenever the first statement is not a
`#version` directive. However, consider the following scene:

    // Just a comment
    global_settings { assumed_gamma 1.0 }
    #version 3.5;
    // ...

This is apparently a scene designed for v3.5, where there was no
requirement for an initial `#version` statement, so for the sake of
backward compatibility we want just a warning, not an error.


Post a reply to this message

From: Kenneth
Subject: Re: #version directive
Date: 10 Feb 2018 15:50:01
Message: <web.5a7f59cec5234a59a47873e10@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 10.02.2018 um 05:52 schrieb Kenneth:

>
> >  B) Assuming that v3.7.1 (or later) *is* the currently running version,
> > and the scene itself does have #version 3.7.1 in it, then the scene
> > already HAS a #version directive-- definitely not a situation where
> > the scene "does not start with a #version directive"(!)
>
> That totally depends on where the `#version 3.71` directive is placed.
>
> Consider the following scene:
{snip]

Ah, that would be 'interpretation C)'-- which I didn't think of. :-(  OK, it's
starting to make sense now. Thanks for the clarification. I can see that the
#version situation -- it's 'permutations' so to speak--is not easy or trifling
to explain in the docs.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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