POV-Ray : Newsgroups : povray.general : #declare Server Time
5 Aug 2024 12:21:34 EDT (-0400)
  #declare (Message 16 to 25 of 25)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Rafal 'Raf256' Maj
Subject: Re: #declare
Date: 19 Oct 2002 20:54:20
Message: <Xns92AD1D47AD740raf256com@204.213.191.226>
"hughes, b." <omn### [at] charternet> wrote in 
news:3db1fdaf$1@news.povray.org

>> Use upper case in your variable names. Upper case words will never be
>> reserved.

Ok - i didn't knew that. Maybe it should be putted in manual and FAQ ?

>> >   "foo"+$x+"bar"  will result in "foo100bar" (x is used like string)
>> >   20 + $x         will result in 120 (x is used like number)
>> You're joking, right? You *like* that?
> That would be weird to me.

PHP users are glad with that :P but it was just a sugestion.


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Robert Chaffe
Subject: Re: #declare
Date: 19 Oct 2002 23:17:03
Message: <3db2202f@news.povray.org>
"Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote in message
news:Xns### [at] 204213191226...
> "hughes, b." <omn### [at] charternet> wrote in
> news:3db1fdaf$1@news.povray.org
>
> >> Use upper case in your variable names. Upper case words will never be
> >> reserved.
>
> Ok - i didn't knew that. Maybe it should be putted in manual and FAQ ?

Section 6.1.1 in manual.

--
Robert Chaffe
http://www.donovansweb.com/~chaffe/


Post a reply to this message

From: Christopher James Huff
Subject: Re: #declare
Date: 20 Oct 2002 11:10:26
Message: <3db2c762@news.povray.org>
"hughes, b." <omn### [at] charternet> wrote in message
news:3db1fdaf$1@news.povray.org...
> Would it be conceivable that a future POV-Ray could tag any and all
> user-defined identifiers, regardless of case, as a non-keyword? It's not
> always compulsory to use upper case letters so it can seem okay. In fact,
> people have often complained they couldn't use a number as the first
> character either.

There are two reasons not to allow keywords as identifiers:
1: Ambiguity. In some cases, it could be impossible or difficult for the
parser to tell a keyword from an identifier of the same name. For example:
def while = 0;
while(while < 10)
{
    while++;
}
Most parsers will try to start another while loop nested in the first one.
Catching this case complicates the parser while adding no functionality.
Another example:

function while(fooBar) {...do something...}
while(1);

Now, write a parser that handles *that* properly. There is no way to tell
the difference between a function call and an infinite loop unless you
change the loop syntax.

You could add a mandatory first character, like "$", but that doesn't solve
anything...it makes things less readable by scattering meaningless symbols
everywhere, and makes every name longer by one useless character.
If you really want variables like this so you can use keywords as names,
just put a "_" in front of the names, like "_while" or "_declare". Does the
same thing, without annoying everyone else. Just don't ask anyone else to
put up with your code...

2: Readability. It is far better if the word used for a keyword is *always*
used for a keyword.


Post a reply to this message

From: Warp
Subject: Re: #declare
Date: 20 Oct 2002 16:28:30
Message: <3db311ee@news.povray.org>
Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
> Yes - it didn't. Do You think it would be a good idea to allow such 
> behaviour ?

  IMHO, no. I like "a+b" a lot more than "$a+$b".

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


Post a reply to this message

From: Greg M  Johnson
Subject: Re: #declare
Date: 21 Oct 2002 13:17:29
Message: <3db436a9$1@news.povray.org>
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
>
> def myCounter = 0;
> while(myCounter < 10) {
>     myCounter += 1;
> }
>


<shudders>

I "mastered" programming in high school and college learning BASIC and some
FORTRAN.

I am too stupid to figure out C.

Please don't make the SDL just a bastardized C.  Don't make it eclectic.  As
klunky as it is, the current SDL is intuitive.


Post a reply to this message

From: Christopher James Huff
Subject: Re: #declare
Date: 21 Oct 2002 14:31:35
Message: <chrishuff-C11C74.14264121102002@netplex.aussie.org>
In article <3db436a9$1@news.povray.org>,
 "Greg M. Johnson" <gregj:-)565### [at] aolcom> wrote:

> I "mastered" programming in high school and college learning BASIC and some
> FORTRAN.
> 
> I am too stupid to figure out C.

More likely you had some kind of block where you decided you couldn't 
learn it. It isn't that hard, though of course I'd never recommend it 
for a scene description language..


> Please don't make the SDL just a bastardized C. 

That wasn't very C-like. There were only a few things that were like C 
in that code: using {} braces to enclose code blocks (which POV already 
does, just not for control statements...if that was the problem, you 
couldn't read POV either), and the "+=" operator, which seems pretty 
intuitive to me. And finally, the "varName = value" syntax for assigning 
to variables...is that so hard to understand? Were you really unable to 
figure out what that code did?


> Don't make it eclectic. 

If anything, the existing language is extremely "eclectic", borrowing 
bits and pieces from C, Pascal, and other languages. I don't think the 
word means what you think it means.


> As klunky as it is, the current SDL is intuitive.

In some ways, in others it is horribly nonintuitive. (quick: you can 
declare textures, finishes, pigments, objects, and functions. Can you 
declare transforms? Can you declare warps? How about patterns? You can 
also make a texture based off an existing one by using "texture 
{TEXTURE_IDENTIFIER MODIFIERS}", can you do the same with unions, blobs, 
or meshes? Is sky_sphere an object? Using shadowless in a light source 
turns off highlights...is that intuitive?)

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: #declare
Date: 23 Oct 2002 12:45:41
Message: <3db6d235$1@news.povray.org>
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
>
> More likely you had some kind of block where you decided
> you couldn't  learn it.
>

Probably.

>
>> Please don't make the SDL just a bastardized C.
>
> That wasn't very C-like.

Well, the old dilemma where I cannot write   #declare a=x^2.5;   anymore.
Common practice (and sense?) conflicted with one of the more obtuse (using
nice words here) features of a few programming languages, so the whole SDL
gets rewritten.

>
>> Don't make it eclectic.
>

Isn't there a word that rhymes with this that means "of interest to, or
understandable by, only a small group of people"?


Post a reply to this message

From: Christopher James Huff
Subject: Re: #declare
Date: 23 Oct 2002 13:24:57
Message: <chrishuff-4EC4FB.13185723102002@netplex.aussie.org>
In article <3db6d235$1@news.povray.org>,
 "Greg M. Johnson" <gregj:-)565### [at] aolcom> wrote:

> Well, the old dilemma where I cannot write   #declare a=x^2.5;   anymore.
> Common practice (and sense?) conflicted with one of the more obtuse (using
> nice words here) features of a few programming languages, so the whole SDL
> gets rewritten.

"def a = x^2.5;" is more obtuse than "#declare a = x^2.5;"?
It really sounds like you just dislike anything that is different or 
unfamiliar.


> >> Don't make it eclectic.
> Isn't there a word that rhymes with this that means "of interest to, or
> understandable by, only a small group of people"?

I think the word you are looking for is "esoteric", also "arcane", 
"mysterious", "inscrutible". And "POV-Script" would already qualify for 
that quite well...it is a pretty strange language, relatively unknown 
compared to most other languages, and eclectic in that it borrows bits 
and pieces from many other langauges. It also makes you learn a lot more 
than is necessary, and has many quirks and inconsistencies. Cleaning it 
up and making it easier to learn will be necessary to get it to a larger 
group of people.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Greg M  Johnson
Subject: Re: #declare
Date: 23 Oct 2002 14:41:57
Message: <3db6ed75$1@news.povray.org>
"Christopher James Huff" <chr### [at] maccom> wrote in message
news:chr### [at] netplexaussieorg...
> In article <3db6d235$1@news.povray.org>,
>  "Greg M. Johnson" <gregj:-)565### [at] aolcom> wrote:
>
>> Well, the old dilemma where I cannot write   #declare a=x^2.5;   anymore.
>
> "def a = x^2.5;" is more obtuse than "#declare a = x^2.5;"?
> It really sounds like you just dislike anything that is different or
> unfamiliar.
>

No, I mean that I now must type  #declare a=pow(x,2.5);

direct followups to povray.^


Post a reply to this message

From: Warp
Subject: Re: #declare
Date: 23 Oct 2002 16:48:24
Message: <3db70b18@news.povray.org>
Greg M. Johnson <gregj:-)565### [at] aolcom> wrote:
> No, I mean that I now must type  #declare a=pow(x,2.5);

  So?

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


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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