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
We have a lot of java things we interact and they can throw exceptions or have null in certain pojo fields to where if we use them in a string interpolator it will just print null
We tried to migrate to show but it blows up and does not give you a good error message to indicate where the problem is.
I asked in Discord and here's the feedback:
don't use nulls (it's very hard to do this especially when integrating with a lot of java teams/libraries)
it's a bug, file a bug (doing that here)
write my own version of show SafeShow and use that.
I've done number 3 and created SafeShow but incorporating it into our legacy monolith is an effort itself so I thought I'd open this to see if anything could be done in cats itself. (I've basically duplicated the show syntax, interpolator and use the typename as required field for constructing the Show type class instance using SafeShow and log the typename and the exception when we recover from NPE before printing "null"). This is not something I really want to maintain although it's not that much code (less than 100 lines of main code). Also most of our libraries just use plain Show so we have to go and change all those as well.
The ability to adopt and use things from cats for newbies is also a hurdle. When do I use our safe show and when do we not.
It's a lot for newbies to absorb and makes the interop with Java stuff harder. It's also a hurdle when things that seem like they should be equivalent are not.
The text was updated successfully, but these errors were encountered:
Maybe a fix would be to make fromToString work correctly with null so it returns "null" or something. That should address the Java interop issue without changing behavior for people that set their own Show instances.
We have a lot of java things we interact and they can throw exceptions or have null in certain pojo fields to where if we use them in a string interpolator it will just print null
We tried to migrate to show but it blows up and does not give you a good error message to indicate where the problem is.
I asked in Discord and here's the feedback:
I've done number 3 and created SafeShow but incorporating it into our legacy monolith is an effort itself so I thought I'd open this to see if anything could be done in cats itself. (I've basically duplicated the show syntax, interpolator and use the typename as required field for constructing the Show type class instance using SafeShow and log the typename and the exception when we recover from NPE before printing "null"). This is not something I really want to maintain although it's not that much code (less than 100 lines of main code). Also most of our libraries just use plain Show so we have to go and change all those as well.
The ability to adopt and use things from cats for newbies is also a hurdle. When do I use our safe show and when do we not.
It's a lot for newbies to absorb and makes the interop with Java stuff harder. It's also a hurdle when things that seem like they should be equivalent are not.
The text was updated successfully, but these errors were encountered: