POV-Ray : Newsgroups : povray.beta-test : Function parameter bug : Re: Function parameter bug Server Time
30 Jul 2024 20:20:18 EDT (-0400)
  Re: Function parameter bug  
From: Warp
Date: 27 Oct 2001 15:59:15
Message: <3bdb1212@news.povray.org>
Rune <run### [at] mobilixnetdk> wrote:
: #declare foo = function(C) {C*2}

: C is not defined before the function. C *is* defined inside the function
: {...} brackets.

  Nope, it isn't. Not from the point of view of the parser. It is not an
identifier which the parser sees.
  That 'C' has become a variable in the function evaluation engine, which is
a completely different beast than the parser. The parser doesn't know anything
about functions, and the function handler doesn't know anything about the
parser. The parser has no notion of a variable/identifier called 'C'.
  In the same way if you had declared an identifier called 'D', then the
*parser* sees and recognizes that 'D', but the function handler is completely
unaware of it (the parser can give the function the value of 'D', but the
function handler doesn't see 'D' in any way).

  Think about the function definition (what is inside { and }) as a string
which is just raw data to the parser unless it contains something the
parser recognizes (eg. a previously declared identifier).

-- 
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}//                     - Warp -


Post a reply to this message

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