POV-Ray : Newsgroups : povray.beta-test : function declaration and namespace Server Time
30 Jul 2024 08:27:56 EDT (-0400)
  function declaration and namespace (Message 11 to 12 of 12)  
<<< Previous 10 Messages Goto Initial 10 Messages
From:
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 09:35:13
Message: <a6cj3u06t5j5piqv2pgb1a4ge34bfd3qcj@4ax.com>
On Mon, 7 Jan 2002 14:23:57 -0000, "Gleb" <gk1### [at] sotonacuk> wrote:
> The difference is not only the order of lines, but in the last case "F" in
> known as function name

I know, I pointed order to underline what changed.

> in current block, so POV is correct, reporting an error..

not for me

F listed in declaration of macro is valid name _only_ in local namespace of this
macro so according to "redeclaration of functions is not allowed" it is formal
as long as it will not be declared as function.

> If we put " #local F=" inside e.g. a macro block, like below, it works OK

yes, I pointed it in this thread

ABX


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 19:05:07
Message: <3C3A373B.2AB132D2@hotmail.com>
Thorsten Froehlich wrote:
> 

> Skiba <abx### [at] babilonorg>  wrote:
> 
> > This is parsed ok:
> >
> > #macro P(F) #end
> > #local F=function{x}
> >
> > and this not:
> >
> > #local F=function{x}
> > #macro P(F) #end
> 
> Ah, now I see.  I missed that it wasn't a macro call.  I am not sure what it
> is then.

It is just one function declaration and one
macro declaration.

- And the macro's parameter just happens to
have the same name as the function.

I think it should be valid code to write. 

Just as this is allowed:

#declare S = sphere { <0, 0, 0>, 1 }

#macro AnyMacro(S)
  (2*S)
#end // AnyMacro

#declare A = AnyMacro(4);


Tor Olav


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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