POV-Ray : Newsgroups : povray.programming : this Server Time
28 Jul 2024 18:14:55 EDT (-0400)
  this (Message 5 to 14 of 34)  
<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Christopher James Huff
Subject: Re: this
Date: 24 Jun 2002 11:42:46
Message: <pan.2002.06.24.10.42.24.248294.635@mac.com>
Personally, I'd prefer "self"... ;-)
I don't think this would work, not with the current object syntax anyway.
If it is available at any point in the object block, then it would have to
be available at times when the object doesn't completely exist yet. There
would be an "invisible line" somewhere where the "self" identifier would
appear, you couldn't do this:

sphere {min_extent(self), 1}

And I'm not sure how CSG objects would handle it in between adding
objects, or meshes while adding triangles. Something like this might work
though:

object {
    sphere {...}
    "self" or "this" is defined in this level, but not in the shape
specification block itself, making sure there is a complete shape to
refer to.
}

Or if the shape parameters used a different syntax or always had default
values...it would be pretty much necessary for my idea of changing the
POV-Ray language into a prototype-based object oriented language.


-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: <chr### [at] tagpovrayorg>
WWW: http://homepage.mac.com/chrishuff/


Post a reply to this message

From: Warp
Subject: Re: this
Date: 24 Jun 2002 12:00:28
Message: <3d17421b@news.povray.org>

> Moreover AFAIK extents are only properity available for script.

  You forget inside().

  (And perhaps also trace() could be in some way thought as a property of
the object...)

-- 
#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: Thorsten Froehlich
Subject: Re: this
Date: 24 Jun 2002 13:15:53
Message: <3d1753c9@news.povray.org>
In article <pan### [at] maccom> , Christopher James
Huff <chr### [at] maccom>  wrote:

> I don't think this would work, not with the current object syntax anyway.
> If it is available at any point in the object block, then it would have to
> be available at times when the object doesn't completely exist yet.

While it would not only not work practically when implemented as a
parse-time variable, it is also not necessary if implemented as a
render-time variable - the scope and object are always known and
well-defined without ambiguity at that time!

    Thorsten


Post a reply to this message

From: Christopher James Huff
Subject: Re: this
Date: 24 Jun 2002 14:22:02
Message: <pan.2002.06.24.13.21.39.584845.635@mac.com>
On Mon, 24 Jun 2002 13:15:46 -0500, Thorsten Froehlich wrote:

> While it would not only not work practically when implemented as a
> parse-time variable, it is also not necessary if implemented as a
> render-time variable - the scope and object are always known and
> well-defined without ambiguity at that time!

Actually, I think it might work fine if everything has a default value
and is considered to exist at the opening { brace.
If that were so, this:
sphere {min_extent(self), 1}
would center the sphere on the min_extent of the default sphere. I don't
know what it would do for meshes or CSG though, and it might not give a
perfectly obvious result all the time...

I'm not sure what you are trying to say about implementing it as a
render-time variable...most of the uses I can think of for it are at
parse time.


-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: <chr### [at] tagpovrayorg>
WWW: http://homepage.mac.com/chrishuff/


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: this
Date: 24 Jun 2002 15:27:58
Message: <Xns9237D9DAD6F60raf256com@204.213.191.226>
Christopher James Huff <chr### [at] maccom> wrote in 
news:pan### [at] maccom:

>> While it would not only not work practically when implemented as a
>> parse-time variable, it is also not necessary if implemented as a
>> render-time variable - the scope and object are always known and
>> well-defined without ambiguity at that time!
> Actually, I think it might work fine if everything has a default value
> and is considered to exist at the opening { brace.

> If that were so, this:
> sphere {min_extent(self), 1}
> would center the sphere on the min_extent of the default sphere. I don't
> know what it would do for meshes or CSG though, and it might not give a
> perfectly obvious result all the time...

I think that is rather easy to implement - even more - I could implement it 
my self - as pre-procesor, and I think that same algorithm will work for
new parser :

1. if You fond keyword 'this' in expresion 'zzz(this)' then 
1a. parse '#declare this_obj = xxx { yyy }' where xxx is type, and yyy are 
object modificers and parameters of object in with keyword 'this' was found
1b. change 'qqq zzz(this)' to 'object {this_obj qqq zzz(this_obj)'
and continue parsing
  qqq zzz(this) - this is last sentens, that was not completly paresed 
(because) 'this' was found while parsing it. 
  i.e.  translate <1,2,3> will be translated fully, and it would be part of
  yyy in  example above, and entrie
  translate min_extent(this) is qqq/xxx

  It should work, ie.:
union { sphere{1,2} sphere{0,1} translate min_extent(this) }
  would become
#declare this_obj = union { sphere{1,2} sphere{0,1} }
object { this_obj translate min_extent(this_obj) }

btw - Name 'this' or 'self' - maybe use both - for users that like C++ and 
thoes who like Pascal/Deplhi ;)





-- 


Post a reply to this message

From:
Subject: Re: this
Date: 25 Jun 2002 02:28:32
Message: <a83ghugo28bo758f44rnio33brf7552qoa@4ax.com>
On 24 Jun 2002 12:00:28 -0400, Warp <war### [at] tagpovrayorg> wrote:
> W?odzimierz ABX Skiba <abx### [at] babilonorg> wrote:
> > Moreover AFAIK extents are only properity available for script.
>
> You forget inside().

I consider inside() more as method. The same way eval_* for pigments and
patterns.

ABX


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: this
Date: 25 Jun 2002 08:19:46
Message: <3d185fe2@news.povray.org>
In article <pan### [at] maccom> , Christopher James
Huff <chr### [at] maccom>  wrote:

> Actually, I think it might work fine if everything has a default value
> and is considered to exist at the opening { brace.

If you carefully consider the scope in either case you will notice that
there is no other than the "this" or "self" (or whatever you call it) scope,
so no need for it as keyword to specify the only available scope.  In
particular because every attribute of the object would be a reserved name
anyway, so no need to disambiguate between local and global variables
either.  Essentially what I am pointing out is that the concept of "this" or
"self" simply does not apply to POV-Ray SDL.

> I'm not sure what you are trying to say about implementing it as a
> render-time variable...most of the uses I can think of for it are at
> parse time.

As we are talking about the future so am I.  Just imagine every expression
being a function rather than a macro.  Then you would apply the changes to
the object after everything is well-defined and order problems would not
exist.

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: this
Date: 25 Jun 2002 08:21:21
Message: <3d186041@news.povray.org>
In article <Xns### [at] 204213191226> , "Rafal 'Raf256' 
Maj" <raf### [at] raf256com> wrote:

> btw - Name 'this' or 'self' - maybe use both - for users that like C++ and
> thoes who like Pascal/Deplhi ;)

But POV-Ray SDL is neither of these, it is POV-Ray SDL and just putting
something useful in a programming language doesn't mean it is useful in
POV-Ray SDL.

    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: Rafal 'Raf256' Maj
Subject: Re: this
Date: 25 Jun 2002 08:32:08
Message: <Xns9238935A0318Araf256com@204.213.191.226>
"Thorsten Froehlich" <tho### [at] trfde> wrote in
news:3d186041@news.povray.org: 

> just
> putting something useful in a programming language doesn't mean it is
> useful in POV-Ray SDL.

it is not very useful, but always a little, and it is rather easy to 
implement as shown in previous post.


-- 


Post a reply to this message

From: Christopher James Huff
Subject: Re: this
Date: 25 Jun 2002 10:09:46
Message: <pan.2002.06.25.09.09.28.750012.635@mac.com>


> I consider inside() more as method. The same way eval_* for pigments and
> patterns.

But you don't consider the *_extent() functions to be methods? I
personally had to keep myself from typing "self.min_extent()". I would
say trace() is the same.


-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: <chr### [at] tagpovrayorg>
WWW: http://homepage.mac.com/chrishuff/


Post a reply to this message

<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>

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