I have a few functions in my 7GUIs implementation that are named map[Something] but which clearly do not map in the usual sense. The general idea behind all the functions is that they encapsulate the destructuring logic for a data structure and call callbacks when one of the patterns match. I would like to get your advice on renaming them appropriately.
mapSelection from Circle Drawer. It is used to implement mapSelected. Both mapSelection and mapSelected are used throughout the update function for a clearer implementation.
map from Cells. This one is actually the most useful since I definitely wouldn’t want to replicate that destructuring logic everywhere it’s needed. And it’s needed in a lot of places: hasError, references, refresh, toFloat, toEditableString, and toString.
I’ve definitely found this approach useful but naming is hard so your help will be greatly appreciated.
I see the idea. Convert the Booking to another data structure that encodes the alternative structure I would want to pattern match over. My way uses functions and your way uses a data structure so it’s a sort of defunctionalization transformation. So what you suggest is another side of the same coin.
I don’t like the name ValidBooking though since it has within it a constructor named Invalid.
But the main question remains: What to name the functions?