GreycLab / gmic

GREYC's Magic for Image Computing: A Full-Featured Open-Source Framework for Image Processing
Other
75 stars 14 forks source link

Anything can be done about status return? I doubt it. #69

Open Reptorian1125 opened 1 month ago

Reptorian1125 commented 1 month ago

Sometimes, I just want to return a old status. So, I have to write something like this.

foo:
old_status=${}
bar=${blah\ 1,23} # Can be other code that affect '{}', but preferably when it's meant to affect a variable.
u $old_status

So, if you have a code like this: bar=${blah\ 1,2,3}, bar should return what blah returned, but old_status gets preserved. Should be reserved when assigning to a variable.

Now, I think it'd be okay to allow status to change if you have a code like:

blah 1,2,3
echo ${}

It's not assigning to a variable.

Other case to consider is when you use () to create image value.

A real world example I just pushed.

(${rep_posdec2altbase_num\ ${rep_BIGINT_division\ $1,{h}},float_max})

However, might not be worth it as it seems to be complex problem. And this seems to require restoring old status by evoking something like ${foo\ fizz,buzz} after finishing execution as you can see in all examples, they all involve something like ${foo\ fizz,buzz}.

dtschump commented 1 month ago

I don't like the idea of having a status that is set or not, depending on how the function is called. Also, it's often that I don't use the ${"-command arguments} on purpose (and do rather command arguments if ${}....), because when your argument contains double quotes or spaces, this is more convenient to use it that way. Like in this example:

files=${"files \"Path With Space/*\""}
files "Path With Space/*" files=${}  # <- I prefer this one