smarr/SOMns

Adapt all exceptions/errors to use factory methods for signaling

smarr opened this issue · 0 comments

smarr commented

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.