> input
You are in input mode. Enter an expression of type <type of Input>
> <ill-typed expression>
You entered an expression of type <type>. Enter an expression of type <type of Input>
> <well-typed expression>
<value of the expression>
for a type of Int would be:
input
You are in input mode. Enter an expression of type Int
>sdfsdf
You entered an expression of type Error. Enter an expression of type Int
> True
You entered an expression of type Bool. Enter an expression of type Int
What should happen is that it (the input expression) should be parsed, type checked, evaluated, and then put the result in the input buffer if the type is correct. This may require some changes on the back end and in that case I can try to help.
In summary:
Expressions provided via input need to be verified, to ensure they match the expected type of Input.
As it stands, we are currently handling input expressions as legitimate BoGL expressions. These currently work, but it brings up the point whether we should only be allowing literals here (again, Alex noted this).
The contents in the input buffer associated with
input
do not currently undergo verification before use. This results in issues with programs like so:And REPL input of:
Pointed out by @alexgrejuc , the above should instead report an error describing the expected and the actual type, and how they do not match (2 examples below pulled from Alex's comment on issue 25 of the frontend):
for a type of Int would be:
In addition from issue #24 on the frontend:
In summary: