Open enikao opened 1 year ago
Is this a language for reporting violations of constraints (/validations), or one for defining those constraints? I think we need both. The definition language is a lot of work: basically something like KernelF. The reporting language can be much smaller.
Is this a language for reporting violations of constraints (/validations), or one for defining those constraints?
It's the reporting language that would be passed to the API (#173). I added an example to the description.
Would this mean defining a class Issue
very similar to this one https://github.com/Strumenta/kolasu/blob/cf9663f9c9488bf885359cba1f498cc27f35d20e/core/src/main/kotlin/com/strumenta/kolasu/validation/Validation.kt#L19?
Quite likely :D
I think that in most cases issues may refer to nodes but there are exceptions, in particular if we want to report issues emerged during parsing or unserializing. In that case we may refer to a position in text or a JSON element, if the error is so bad to prevent building a proper node
I think that we need many quite different kinds of issue types, to take into account what you can point to as the problem. The correctness proposal as well as Jos' implementation of the validators also plays into this.
First draft: https://github.com/LionWeb-io/lionweb-mps/pull/89
Checking a model for consistency and other errors is one of the most common operations on models. It might also be expensive: if we wanted to assure globally unique names, we had to check all named things in our model on every name change. The basic structure of validation is very similar in most systems: any issue has a severity level, refers to a node, might relate to a feature, and provides an error message.
As an example, we might define concepts for
Error
,Warning
, andInfo
.My specific validator implementation would create instances of
Error
andInfo
, but also include a custom compiler-based validation language that definesGeneratorWarning
andCompilerWarning
as specializations ofWarning
. A client that only knows about this validation base language can process both of the specialized warnings in a generic fashion. Another, compiler-aware client might displayGeneratorWarning
s differently thanCompilerWarning
s.