POV-Ray : Newsgroups : povray.beta-test : function declaration and namespace Server Time
30 Jul 2024 06:23:27 EDT (-0400)
  function declaration and namespace (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From:
Subject: function declaration and namespace
Date: 7 Jan 2002 02:27:37
Message: <l2ji3uc2k9su99o2gct3n2thgqoq7f4pd5@4ax.com>
POV 3.5 b 9.icl on PII 233 128 MB with NT 4 Sp 6
POV 3.5 b 9.icl on PII 233 128 MB with Win95 OSR2

below script stops at header of macro with message
"Expected 'identifier or expression.', function_id found instead"

#local F=function{x}
#macro P(F) #end

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 07:15:35
Message: <3c399167@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

> POV 3.5 b 9.icl on PII 233 128 MB with NT 4 Sp 6
> POV 3.5 b 9.icl on PII 233 128 MB with Win95 OSR2
>
> below script stops at header of macro with message
> "Expected 'identifier or expression.', function_id found instead"
>
> #local F=function{x}
> #macro P(F) #end

Works as it should.  Please refer to the documentation.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 07:27:35
Message: <sj4j3ucmp9do8nlr46a56cf09bu95jrh6m@4ax.com>
On Mon, 07 Jan 2002 13:15:30 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> > below script stops at header of macro with message
> > "Expected 'identifier or expression.', function_id found instead"
> >
> > #local F=function{x}
> > #macro P(F) #end
>
> Works as it should.  Please refer to the documentation.

6.2.8.1: "PARAM_IDENTs are a list of zero or more formal parameter identifiers
separated by commas and enclosed by parentheses".

F is formal in local namespace of macro P for me and should works just like
below script:

#local F=function{x}
#macro P(C) #local F=C; #end
P(1)

Is there any other place in documentation where it is precised ?

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 07:32:20
Message: <3c399554@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

> 6.2.8.1: "PARAM_IDENTs are a list of zero or more formal parameter identifiers
> separated by commas and enclosed by parentheses".
>
> F is formal in local namespace of macro P for me and should works just like
> below script:
>
> #local F=function{x}
> #macro P(C) #local F=C; #end
> P(1)
>
> Is there any other place in documentation where it is precised ?

6.1.6.1 Functions and Macros


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 07:35:24
Message: <4d5j3ukkckm30bsj12n0i72i04uhgmmkrt@4ax.com>
On Mon, 07 Jan 2002 13:32:17 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> > Is there any other place in documentation where it is precised ?
>
> 6.1.6.1 Functions and Macros

but it is about calling macro,
I'm talking about declaring

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 07:39:55
Message: <3c39971b$1@news.povray.org>

Skiba <abx### [at] babilonorg>  wrote:

> but it is about calling macro,
> I'm talking about declaring

???

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 07:47:47
Message: <ps5j3u42jdj85v0jfr3jeaj8e2i2vn3qsa@4ax.com>
On Mon, 07 Jan 2002 13:39:55 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:

> ???

here is list of cases from 6.1.6.1.

"You can use macros in functions, but the macros will be called only once when
the function is defined, not every time the function is called."

This is not my case becouse I'm not declaring function.

"You cannot pass function variables to the macros."

This is not my case becouse I'm not calling macro and therefore no parameters
are passed.

"You can pass functions to macros, how to do this is best explained by an
example."

As above.

I'm declaring.

This is parsed ok:

#macro P(F) #end
#local F=function{x}

and this not:

#local F=function{x}
#macro P(F) #end

The only difference is the order of lines.

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 08:18:10
Message: <3c39a012@news.povray.org>

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.

    Thorsten

____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From:
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 08:20:29
Message: <c28j3uod9ldtp8bo2cf8fq1t5p9ugdddq1@4ax.com>
On Mon, 07 Jan 2002 14:18:08 +0100, "Thorsten Froehlich" <tho### [at] trfde>
wrote:
> Ah, now I see.  I missed that it wasn't a macro call.

Now I'm happy it's not my English again :-)

ABX


Post a reply to this message

From: Gleb
Subject: Re: function declaration and namespace
Date: 7 Jan 2002 09:23:57
Message: <3c39af7d@news.povray.org>
The difference is not only the order of lines, but in the last case "F" in
known as function name

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

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

//----------------------------
 #macro  M(F)
 #local F=function{x}
 #end

 #macro P(F) #end

 /*----------------------------
 6.2.2.2  #declare vs. #local

 Use of #local in the main scene file (not in an include file and not in a
macro)
  is identical to #declare.
  For clarity sake you should not use #local in a main file except in a
macro.
 */


atb,

gleb


"W?odzimierz ABX Skiba" <abx### [at] babilonorg> wrote in message
news:ps5j3u42jdj85v0jfr3jeaj8e2i2vn3qsa@4ax.com...
> On Mon, 07 Jan 2002 13:39:55 +0100, "Thorsten Froehlich" <tho### [at] trfde>
> This is parsed ok:
>
> #macro P(F) #end
> #local F=function{x}
>
> and this not:
>
> #local F=function{x}
> #macro P(F) #end
>
> The only difference is the order of lines.
>
> ABX


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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