POV-Ray : Newsgroups : povray.pov4.discussion.general : POV-Ray 4 SDL: Some concrete proposal : Re: POV-Ray 4 SDL: Some concrete proposal Server Time
14 Apr 2024 04:44:46 EDT (-0400)
  Re: POV-Ray 4 SDL: Some concrete proposal  
From: clipka
Date: 16 Apr 2009 13:30:01
Message: <web.49e76ac83a7e550ef708085d0@news.povray.org>
Lukas Winter <web### [at] geloeschtremovethisandthedotbeforenet> wrote:
> then again I think the approach "everything is a property" is
> very elegant.
> I still believe that if no prefix is specified, the variable/property to
> be accessed should be the most local one that's defined.

Yes, I also think that would make for a clean thing, and in any other language
I'd quickly agree.

There is one thing here, however, that worries me:

In other languages, whenever a "more local" variable enters the scene, it is
clearly visible, because it is either declared, assigned to, or appears in a
formal parameter list.

In our language, a block like

MySphere = sphere {
  center = <1,2,3>;
  radius = 4.2;
};

would introduce "more local" variables only *implicitly*, by them being
properties of "sphere".

Now if in a later version of POV, "sphere" would ever happen to get an
additional property named "i" or "temp", it would break a whole lot of scripts,
like:

i = 0;
MySphere = sphere {
  center = x*i;
  radius = temp;
};

Granted, these variable names are an extreme example, and nobody in his sane
mind would probably introduce them as new object properties. But the same could
basically happen with *every* name.

> If this language allows me to define a construction that does the same as
> @ or ?, then it's fine. Maybe with
>
> #for([int] list, #func(int)) = {@ i list { func(i) }}
>
> for([1,10], #(i) {
>   ? i < 5 {
>      <<i
>     } | {
>       <<"many"
>     }
>   })
>
> Then the langauge is powerful enough for me to create my own verbosity. I
> must admit that nobody would want to do things like that all the time,
> but then again this fictional language is an extreme example.

I think you're quite an exception regarding this practice. Let alone that I
think it is bad style, because it makes the code hard to read for other users
of the language, who are accustomed to the standard syntax.

(In the trade I work in, for instance, such things as "rolling your own
language" would typically be a complete no-go.)


Post a reply to this message

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