bmi icon indicating copy to clipboard operation
bmi copied to clipboard

Reference variables by number rather than name strings

Open PhilMiller opened this issue 2 months ago • 4 comments

String processing is cumbersome to implement and potentially expensive during execution. We already accept identifying grids by number rather than name. Let's shift to identifying variables by number, since their names are going to be passed around much more frequently.

PhilMiller avatar Nov 04 '25 01:11 PhilMiller

Rolf suggests this hurts usability and code readability for simpler use cases

Bert noted concerns around dynamic or parseable variables names. It could be a time savings, but shifts burdens around

Bert noted wrappers on libraries like NetCDF in Matlab to simplify usage while maintaining a low-level efficient API.

PhilMiller avatar Nov 04 '25 15:11 PhilMiller

Fred: suggests an alternative approach of adding a foo_by_index set of advanced/fast versions, to keep the simple readable/teachable versions in place, while allowing optimization.

PhilMiller avatar Nov 04 '25 15:11 PhilMiller

Agreement on "can implement a friendly interface on an efficient interface, but can't implement an efficient interface on a cumbersome interface"

PhilMiller avatar Nov 04 '25 15:11 PhilMiller

Potential to implement desired functions in a "high performance methods" extension

PhilMiller avatar Nov 04 '25 15:11 PhilMiller