CPN Tools sometime reports a typing error, when this should be no problem in (other) ML-like languages. Either the type inference should be done correctly, or at least a warning should be issued.
Example: I define a global variable “si” of type SI (for Strings Int). Type SI is defined as follows: record sl : stringlist * i : INT If “si” is initially set to {sl = [“init”] , i = 2}, then everything goes fine. In particular, I can safely update “si” later, using a function updateSI that changes “si” as follows: SI.set_sl si [“test”]
However, if I initialize “si” to an empty list, e.g., : {sl = [] , i = 2} then the model is unsound (things are colored in red in CPN Tools). I did not find a way to copy/paste an error message from CPN Tools, but basically, the tool is complaining that “operator and operand do not agree [tycon mismatch]”.
To my opinion, this is perfectly correct. Such a construction in functional languages such as Caml would perfectly work: The type checker should infer that [] and [“string”] both have “string list” as a type. If si should be required to be typed, then CPN Tools should warn for it.
You must be logged in to post a comment.