[PROJ] Make push and pop FIFO?

Greg Troxel gdt at lexort.com
Sat Dec 16 06:23:56 PST 2023


"Lesparre, Jochem via PROJ" <proj at lists.osgeo.org> writes:

> Hi Thomas,
>
> Thanks for your reply. I will open an issue, but I wanted to make sure
> I wasn’t overlooking an already available solution for my
> problem. Also, I thought it might be better to find consensus in the
> email list first. Or would it be better to have a discussion like this
> in an issue? I am not so familiar with the do’s and don’ts of
> open-source collaboration.
>
> exch / swap
> Your suggestion is a third way to solve my problem. That would work fine.
>
> LIFO / FIFO
> Switching from LIFI to FIFO seems an easier solution to me. But I have
> no experience with stacks in programming languages, so maybe FIFO is
> too unconventional? Or would the change in behaviour from LIFI to FIFO
> be problematic for other users? I have never seen a PROJ pipeline
> using more than one value on the stack.
>
> Alternative
> A difference between PROJ and the language Forth is that PROJ has a
> coordinate value next to the stack. My suggested flip operator does
> the same as your exch / swap operator. The only difference is that I
> interpret the current coordinate value as the top value of the
> stack. The advantage is that my alternative needs just one step:
>
> +step +proj=flip +v_3
>
> to do the same are your 3 steps:
>
> step omit_fwd proj=push v_3              # restore the geometrical height
> step omit_fwd proj=exch                  # swap the two heights, to get the geometrical to the top-of-stack
> step omit_fwd proj=pop v_3               # save the geophysical height
>
> Name
> Even if my alternative behaviour of flip would be implemented, I think
> your suggested name exch or swap would better explain what it
> does. Could there be a need for other stack operators too, like dup,
> over, rot and drop? To avoid confusion with other PROJ operators like
> axisswap and over, maybe a name like stackswap could be preferable?

I like exch.   We are really re-inventing the traditional HP RPN, and
that's ok, but it's better to re-implement it as consistently as
possible.


More information about the PROJ mailing list