You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feel free to close this issue if y'all think otherwise! no hard feelings whatsoever. Just something that crossed my mind when i initially came across the function when looking for ftl.Singleton:
ftl.Map feels a wee bit ambiguous. i think folks would instinctively think of a map[string]any sort of map prior to thinking: "Map this resource to this function".
If someone did go as far as hovering over Map to read the godoc, it sort of makes it sound like you're using Map to create a binding between a resource and a function so that anywhere the resource is fetched, that function would execute instead. Maybe ftl.Use or ftl.UseResource would be more clear.
The text was updated successfully, but these errors were encountered:
I think most programmers today are familiar with the concept of "map" as a higher order function, so I think the name is fine. Also the signature makes it very clear it's not related to a map data structure. If anything I think Use is more confusing, to me personally at least?
Maybe the docs could change to reflect its purpose better though? But another option might be making it a method on the Handle interface, though that means that every resource type would have to implement that method, which would be annoying.
Note
Feel free to close this issue if y'all think otherwise! no hard feelings whatsoever. Just something that crossed my mind when i initially came across the function when looking for
ftl.Singleton
:ftl.Map
feels a wee bit ambiguous. i think folks would instinctively think of amap[string]any
sort of map prior to thinking: "Map this resource to this function".If someone did go as far as hovering over
Map
to read the godoc, it sort of makes it sound like you're usingMap
to create a binding between a resource and a function so that anywhere the resource is fetched, that function would execute instead. Maybeftl.Use
orftl.UseResource
would be more clear.The text was updated successfully, but these errors were encountered: