POV-Ray : Newsgroups : povray.bugreports : #local 'bug' cripples usefulness Server Time
23 Dec 2024 18:15:38 EST (-0500)
  #local 'bug' cripples usefulness (Message 1 to 5 of 5)  
From: Philippe Debar
Subject: #local 'bug' cripples usefulness
Date: 26 Sep 1998 07:06:29
Message: <360cbca5.0@news.povray.org>
This problem greatly decreases the value of the #local declaration: you
can't have a local identifier with a different data type from a same-named
global identifier.

e.g. you can't:

(main file) #declare anItem=4;
(include file) #local anItem="test"

This restriction should be at least signaled in the final docs...

----------------------------------------------------------------
   POV INFO
----------------------------------------------------------------
POV-Ray for Windows
Version 3.1.beta.6b.watcom.win32 [Pentium II optimised]


----------------------------------------------------------------
   SYSTEM INFO
----------------------------------------------------------------
MS Windows 95 4.00.950 B
IE 4.0 4.711712.6
Pentium Pro 233MHz
128MB RAM


Post a reply to this message

From: Dan Connelly
Subject: Re: #local 'bug' cripples usefulness
Date: 26 Sep 1998 09:23:09
Message: <360CDC9A.FA6A3850@flash.net>
Philippe Debar wrote:
> 
> This problem greatly decreases the value of the #local declaration: you
> can't have a local identifier with a different data type from a same-named
> global identifier.
> 
> e.g. you can't:
> 
> (main file) #declare anItem=4;
> (include file) #local anItem="test"

This feature also exists in 3.1.watcom.win32.r1 ( Windows 95 ).

Note doing an #undef anItem  before #local prevents the error
message.

An example of an error-generating file :

------- local_test.pov -------------
#declare a = pigment { color rgb 0.5 } 

#include "local_test.inc"

camera { location 3 look_at 0 }
light_source { 4 color 1 }
sphere { 0, 1 pigment { a } }
------------------------------------

------- local_test.inc -------------
#local a = 4;   // this line generates an error
------------------------------------

Dan
PII 128MB W95

-- 
http://www.flash.net/~djconnel/


Post a reply to this message

From: Philippe Debar
Subject: Re: #local 'bug' cripples usefulness
Date: 27 Sep 1998 09:22:35
Message: <360e2e0b.0@news.povray.org>
Hello

Dan Connelly wrote in message <360CDC9A.FA6A3850@flash.net>...

>Note doing an #undef anItem  before #local prevents the error
>message.


Yes, of course it does... to be on the safe side, you can even add something
like

#ifdef (anItem)
  #local thrulyImprobableName_dkjgglk=anItem
  #undef anItem
#end

<some code>

#undef anItem
#ifdef(thrulyImprobableName_dkjgglk)
  #declare anItem=thrulyImprobableName_dkjgglk
#end

BUT, apart from being tedious, (and eventually fucking up the anItem true
scope) this does not keep what I thought to be the main advantage of #local:
the opportunity to use any name in generic #include files.

Don't misunderstand me: I do not complain - I explain. Pov is really good
and I really apreciate #local much as it is. I hope this slight restriction
will be indicated in the final manual.


Povingly,


Philippe


Post a reply to this message

From: Nieminen Mika
Subject: Re: #local 'bug' cripples usefulness
Date: 27 Sep 1998 11:19:31
Message: <360e4973.0@news.povray.org>
Philippe Debar <phi### [at] hotmailcom> wrote:
:   #local thrulyImprobableName_dkjgglk=anItem

  This doesn't work if 'anItem' is anything but a float or a vector. For
example, if it's a texture it have to be inside a texture{} block.
  This in pov3.02 (I have no 3.1 right now to test, so maybe it have
changed?).
  I think this is a deficiency.

-- 
                                                           - Warp. -


Post a reply to this message

From: Dan Connelly
Subject: Re: #local 'bug' cripples usefulness
Date: 27 Sep 1998 11:21:52
Message: <360E49FF.514B3916@flash.net>
Phillippe:

My reply wasn't intended to provide a suggestion to you.
Rather, I was stating for the record my observations.
One might expect that #undef before #local would
have no effect.... and if the latter is broken,
perhaps the former is as well.

This group is not the correct forum for me to discuss
how you should write your POV code.

The implementation of local scope is, I think, flawed.
My reading of the source code is that the way it is done (in parse.c)
is to save the old variable as a temporary variable but use
the old definition as a template for the new definition.

I think it would be better to forget about the old
symbol table reference :

1. rename the old symbol to a temporary name
2. create a new symbol table entry in the current
   scope "from scratch"

I agree this "feature" seriously comprimises the
abstraction offered by the #local construct.

Dan


Philippe Debar wrote:
> Dan Connelly wrote in message <360CDC9A.FA6A3850@flash.net>...
>> ...
> Yes, of course it does... 


-- 
http://www.flash.net/~djconnel/


Post a reply to this message

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