What is the use of the null?
There might be future benefit of having the null
value but looking at the current state of the language and the tests it seems we need no null
. Especially, according to grammar, it can be a comparison operand. But if I write print(3 == null)
(though the case is trivial) there is a type mismatch error.
The null
should be kept only if some function returns null
. But the check will not work due to type mismatch. Also this print(if(true, null, 1))
gives me a type mismatch error.
The third use case according to grammar is to be Parameter
. Let us take series s = (nonsense: null, null)
that is formally correct and the type of all element is the same. I get this error message:
Traceback (most recent call last):
File "virtmat-tools/vre-language/src/virtmat/language/utilities/errors.py", line 67, in wrapper
return func(*args, **kwargs)
File "../scripts/run_model.py", line 25, in main
program = meta.model_from_file(sys.argv[1], source_code=model_str)
File "jupyter-tensorflow-2022-06-20/lib64/python3.8/site-packages/textx/metamodel.py", line 658, in model_from_file
return self.internal_model_from_file(
File "jupyter-tensorflow-2022-06-20/lib64/python3.8/site-packages/textx/metamodel.py", line 712, in internal_model_from_file
p(model, self)
File "virtmat-tools/vre-language/src/virtmat/language/constraints/typechecks.py", line 59, in check_types_processor
_ = obj.type_
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "virtmat-tools/vre-language/src/virtmat/language/constraints/typechecks.py", line 82, in variable_type
return self.parameter.type_
File "/usr/lib64/python3.8/functools.py", line 967, in __get__
val = self.func(instance)
File "virtmat-tools/vre-language/src/virtmat/language/constraints/typechecks.py", line 309, in series_type
typespec = {'datatype': next(iter(types)), 'datalen': len(self.elements)}
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "../scripts/run_model.py", line 34, in <module>
main()
File "virtmat-tools/vre-language/src/virtmat/language/utilities/errors.py", line 71, in wrapper
raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception
Edited by Ivan Kondov