[PROJ] Make push and pop FIFO?
Even Rouault
even.rouault at spatialys.com
Thu Feb 8 11:05:23 PST 2024
If the reciprocal of "Only fools don't change their mind" holds, then
I'm feeling particularly intelligent right now.
The stack approach still doesn't pass my "good taste" / "appropriate for
the 21th century and beyond" criteria. It obviously can be implemented,
but should it?
I believe the main objection to named variable, was : what happens when
one nests / copy-paste part of pipelines in a more complex pipelines.
And maybe the answer should be just what modern programming languages
use in that situation: function scopes. A variable is only visible in
its function scope, but not in calling or called function scopes
+proj=function +start
+proj= ... do something useful here ...
+proj=save from=1,3 into=first,third
+proj= ... do something useful here ...
+proj=function +start # Start of a new nested pipeline
+proj= do something useful here, possibly using first and third as
variable names, in total isolation from what happened before
+proj=function +end # End of nested pipeline
+proj= ... do something useful here ...
+proj=restore into=1,3 from=first,third
+proj= ... do something useful here ...
+proj=function +end
+proj=function would be fully optional. There would be an implicit
function frame when executing a pipeline. You'd only use it explicitly
if you need to do such nested structures. I believe that the current
+push/+pop stacks (as being thoughts as alternative approach to named
variables) should be only valid within a function scope (thus at
function start, you start a new stack frame)
We could possibly, later, much later, enhance function start to pass
caller variables to the callee, and function end to return callee
variables to the caller, if there was ever such a use case to ... pop up
... if I might say.
Even
Le 06/02/2024 à 14:43, Thomas Knudsen a écrit :
> Thanks Even! This is really awesome. I have taken a brief look at the
> code and docs.
> At first read, some of the docs confused me a bit - but I will take a
> closer look
> Thursday (I'm fully booked right now)
--
http://www.spatialys.com
My software is free, but my time generally not.
More information about the PROJ
mailing list