"Is it possible to simply extend the kernel class with a new method, or is there a better way?"
There are trade-offs in this decision. In fact, Pharo had String → asUrl until very recently, when it was removed as part of a system cleanup . On the one hand, some believe that a bad style (see Kent Beck Best Practices) has methods for converting between objects that do not have similar protocols (semantically similar). In addition, this leads to bloated class kernels (e.g. String and Object). However, there may be a good reason in your own application that balances these factors, and since you are packing them in your application and not in the system, get out.
Sean DeNigris
source share