geminiplanetimager / gpi_pipeline

Gemini Planet Imager Data Reduction Pipeline
Other
8 stars 6 forks source link

improved primitive argument handling using scope_varfetch #29

Open dsavransky opened 8 years ago

dsavransky commented 8 years ago

Right now for any given primitive argument, one has to explicitly read in that argument's value from the modules array and assign it to some local variable, generally along with given a default:

if tag_exist( Modules[thisModuleIndex], "display") then display=uint(Modules[thisModuleIndex].display) else display=0

There are a lot of instances of that boilerplate code spread across the primitives.

I just realized it should be possible to eliminate all of them using the scope_varfetch low-level command to automatically set all those variables. It would work something like this:

Wish I'd thought of that a long time ago! At this point, would redoing it to work that way be worthwhile or just confusing? Note that even if we were to implement this automatic argument-to-variable setting, it wouldn't break any existing code; all the affected variables would just get set twice to the same values.

dsavransky commented 8 years ago

Recovering rm journals for issue:

mperrin: Setting to low priority - this would be nice to have in terms of code clarity but doesn't bring new functionality in the end.