StevenLooman / magik-tools

Sonar Magik plugin
GNU General Public License v3.0
18 stars 10 forks source link

Make configurable to check procedures for TypeDocCheck #121

Closed sebastiaanspeck closed 1 week ago

StevenLooman commented 1 week ago

Why would you want to check methods but not check procedures? Procedures are also callable, just like methods, which return values (types) and have parameters (types).

sebastiaanspeck commented 1 week ago

Why would you want to check methods but not check procedures? Procedures are also callable, just like methods, which return values (types) and have parameters (types).

That is true, although if you have a procedure within a method, or a sort_proc, the parameters is most of the time already known.

StevenLooman commented 1 week ago

The type doc actually serves two purposes:

  1. To let the users of the method/procedure know what types the parameters should be, what types the user can expect to be returned, and in case of an iterator what types will be iterated on. I.e., external to the method/procedure.
  2. To ensure the method which calls methods on the parameters exist, that the method actually returns what the docs say it returns, and that it actually iterates over the types what the docs say it iterates on. I.e., internal to the method/procedure.

For any method/procedure, even just a small sorter procedure, you can use no 2 to ensure - even before compiling/testing - the method/procedure actually does what it says it does. Of course, this requires that the method/procedure can be fully reasoned with. This requires all used methods to be annotated/their typing information to be known.