|
|
|
|
|
|
| |
| |
|
|
From: Chambers
Subject: Identifier declaration consistent with other languages
Date: 20 Jul 2008 13:56:59
Message: <48837c6b$1@news.povray.org>
|
|
|
| |
| |
|
|
Instead of
#declare myobj = object {
Why not use
object myobj {
It's more consistent with pretty much every other programming language
since BASIC dropped the "LET" keyword.
...Chambers
Post a reply to this message
|
|
| |
| |
|
|
From: Warp
Subject: Re: Identifier declaration consistent with other languages
Date: 20 Jul 2008 17:59:46
Message: <4883b551@news.povray.org>
|
|
|
| |
| |
|
|
Chambers <ben### [at] pacificwebguycom> wrote:
> Instead of
> #declare myobj = object {
> Why not use
> object myobj {
The intention is to redesign the SDL for pov4 anyways. What we need is
a good overall design rather than just individual bits.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp <war### [at] tagpovrayorg> wrote:
> Chambers <ben### [at] pacificwebguycom> wrote:
> > Instead of
>
> > #declare myobj = object {
>
> > Why not use
>
> > object myobj {
>
> The intention is to redesign the SDL for pov4 anyways. What we need is
> a good overall design rather than just individual bits.
>
> --
> - Warp
I'd like to see more powerful scripting support as well. I use Python
frequently to generate POV-ray code.
An a syntax change:
Instead of
#declare count = 10
#declare pos = 0
#declare MyObject = union {
#while(pos < count)
circle {
<0, 0, 5>, 0.5
rotate <0, pos * 360 / count, 0>
texture {
pigment {
#if(pos % 2 == 0)
color White
#else
color Black
#end
}
}
}
#declare pos = pos + 1
#end
}
Why not simply have:
count = 10
MyObject = union {
for(pos = 0, pos < count, pos = pos + 1) {
circle {
<0, 0, 5>, 0.5
rotate <0, pos * 360 / count, 0>
texture {
pigment {
if(pos % 2 == 0) {
color White
} else {
color Black
}
}
}
}
}
}
MyMacro = macro(p1, p2, p3) {
/* Macro body */
}
MyMacro(x, y, z)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Other ideas:
Currently there is a difference between declaring an item and using it:
// Declare a circle
#declare MyCircle = circle {
...
}
// Use a circle
circle {
...
}
// or
object {
MyCirlce
...
}
When you use the item you can't give its 'instance' a name however. In most
languages you can declare objects and create named instances of these objects.
// Declare an object (but don't use/create and instance of it)
circle MyCircle
{
}
texture MyTexture
{
pigment
{
color Green
}
}
// Create an unnamed instance of an unnamed object
circle
{
}
// create an unnamed instance of a named object
MyCircle
{
}
// Create a named instance of a named object
circle1 = MyCircle
{
// overrides
}
circle2 = MyCircle
{
scale circle1.radius
texture { MyTexture }
}
circle3 = MyCircle
{
<(circle2.x + circle1.x) / 2,
(circle2.y + circle1.y) / 2,
0>
}
Better yet why not have a full scripting built on top of an existing scripting
language (of course security may be an issue) such as Python, or AngelScript,
etc
Post a reply to this message
|
|
| |
| |
|
|
From: Warp
Subject: Re: Identifier declaration consistent with other languages
Date: 5 Nov 2008 16:31:36
Message: <491210b8@news.povray.org>
|
|
|
| |
| |
|
|
Allen <bri### [at] yahoocom> wrote:
> Why not simply have:
Some could argue that this is why:
> }
> }
> }
> }
> }
> }
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp <war### [at] tagpovrayorg> wrote:
> Allen <bri### [at] yahoocom> wrote:
> > Why not simply have:
>
> Some could argue that this is why:
>
> > }
> > }
> > }
> > }
> > }
> > }
>
> --
> - Warp
Yes, but how is that any worse than something like:
}
#end
}
#end
}
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Another way to do away with #end/{/} may be to adopt a Python-like blocking
mechanism where the indentation level affects the block. Then a block as above
could simply be:
MyRing = union:
for(x=0,x<10,x=x+1):
circle:
<...>
....
One problem I've heard from critics of this system is that most editors can't
automatically detect and create folds.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I am categorically against whitespace having meaning.
...Ben Chambers
www.pacificwebguy.com
> -----Original Message-----
> From: Allen [mailto:bri### [at] yahoocom]
> Posted At: Sunday, November 09, 2008 11:36 PM
> Posted To: povray.pov4.discussion.general
> Conversation: Identifier declaration consistent with other languages
> Subject: Re: Identifier declaration consistent with other languages
>
> Another way to do away with #end/{/} may be to adopt a Python-like
> blocking
> mechanism where the indentation level affects the block. Then a block
> as above
> could simply be:
>
> MyRing = union:
> for(x=0,x<10,x=x+1):
> circle:
> <...>
> ....
>
>
> One problem I've heard from critics of this system is that most
editors
> can't
> automatically detect and create folds.
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Chambers" <ben### [at] pacificwebguycom> wrote:
> I am categorically against whitespace having meaning.
>
I tend to agree. It would, to my mind, create another level of difficulty in
trying to track down erroneous bits if code. Not being a programmer per se
(except with the POV SDL), I'm thinking that both the space bar and the tab
button would create identical(?) white spaces. Of course, that may be my naive
and uninformed notion. Please correct me if I'm wrong; I'm willing to learn!
Ken W.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] earthlinknet> wrote:
> "Chambers" <ben### [at] pacificwebguycom> wrote:
> > I am categorically against whitespace having meaning.
> >
>
> I tend to agree. It would, to my mind, create another level of difficulty in
> trying to track down erroneous bits if code. Not being a programmer per se
> (except with the POV SDL), I'm thinking that both the space bar and the tab
> button would create identical(?) white spaces. Of course, that may be my naive
> and uninformed notion. Please correct me if I'm wrong; I'm willing to learn!
>
> Ken W.
I'm pretty certain that Python considers a tab character in the input to be
equal to 8 space characters. It is really my only complaint with Python, in
all other ways I really enjoy Python.
With such code it is better not to mix tabs/spaces else visually you can't
really see where a block is at. Nice thing about C/C++, braces can be anywhere
and statements are terminated with a semicolon so it can span multiple lines
anywhere. Python can only span multiple lines with a line continuation or
inside of groups such as [], (), and {}
Invalid python:
list =
[
1,
2,
3
]
Valid:
list = [
1,
2,
3
]
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |