Input needed: functions wishlist

I appreciate the feedback and info on how you use these! Please don’t take any of this as dismissing your request/ideas. Sometimes I offer alternatives/workarounds or might have a preference in direction.

Long term goal: Global speed slider

This is mainly why I convert the map to world units[1][2][3] that scale to any display (or arbitrary non-grid map). Sometimes pixel counts need to be known and assume a regular grid (e.g. making 2D pixel buffers), and a canvas or raster API could help. For now, a few lines of code to configure the size at the top.

For hardware / pin setups, I would expect the pin used to be highly variable and pin numbers to be configurable in code near the top (like most Arduino sketches).

I hope to abstract much of that. Imagine a UI config that lets you tie a slider to an analog input or trigger to a button/touch pin, the pattern is abstracted away from any hardware.

From a language perspective, perhaps I can alias or implement analogRead() on V2 so the API matches and would only need a pin config change.

For other language differences, unfortunately there isn’t an easy way to do polyfills at runtime. Using a function that doesn’t exist will create a compile error, even if it’s wrapped in an if(). Defining an identifier will mask a built-in, and would cause errors if undefined (we called the polyfill arctan2 instead of atan2 partially for this reason). So its quite possible to implement functionality in code, but not conditionally even if you had a way to detect the version.

Quick historical aside: the atan2 function was fixed before V3 released, so that wasn’t so much a platform thing as a version thing.

Unfortunately V2 language & API lagged behind V3 for a while, and during that time some patterns were made that wouldn’t run on V2 without extra work. I would have preferred that it didn’t work out that way, but resources are limited. I kicked off a poll to get a feeling for how y’all felt, proceeded accordingly until I realized how much harm it was causing to the pattern community (and had time to address it).

I prefer that if folks are updated to the latest version that the code would “just work” without needing any extra smarts in the code. Simplicity and universality of patterns is a big goal.

3 Likes