SOMns icon indicating copy to clipboard operation
SOMns copied to clipboard

Adapt all exceptions/errors to use factory methods for signaling

Open smarr opened this issue 6 years ago • 0 comments

Currently, most exceptions are defined in a way that calls the signal method as part of the constructor. This is problematic, because it makes subclassing correctly impossible.

For example: https://github.com/smarr/SOMns/blob/dev/core-lib/Kernel.ns#L902-L905

  public class IndexOutOfBounds signalWith: obj index: idx = Exception (
    | public target = obj.
      public index  = idx. |
    self signal
  )()

Any subclass would not have its fields properly initialized, which we need to fix by using factory/class-side methods for signalWith:*, and change the primary factory methods (constructors) to merely take the arguments and store them.

smarr avatar Feb 18 '18 21:02 smarr