You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to annotate global variables and property declarations with a type. (Could annotate --> arrays as well.) Then the compiler could generate warnings (not errors) on object definitions and statically-typable assignments.
This would be entirely opt-in. An unannotated declaration would not be type-checked, which is how Inform works today.
What's a type? At a minimum we need Number, String, Routine, Class, Dictionary, and combined types like String|Routine. Maybe specific object classes too. Can a type include "or zero"? What about "or -1"? (The library defines NULL = -1, and it's a valid value for before.) (In fact the veneer recognizes -1 in such properties.) A list of constant values for an enum?
I am not even getting into the question of how to spell these annotations.
This is difficult but potentially very helpful to authors. Inciting example:
Object obj with article 'the';
(The library wants the article property to contain a string, not a dict word.)
There is one example of this in the compiler already: the built-in name property is known to contain dict words. Therefore, with name "lamp" "lantern" is interpreted as a list of dict words even though they have double quotes.
I don't know if I want to perpetuate (or perpetrate) that kind of syntax hack, but warnings are fine.
It would be nice to annotate global variables and property declarations with a type. (Could annotate
-->
arrays as well.) Then the compiler could generate warnings (not errors) on object definitions and statically-typable assignments.This would be entirely opt-in. An unannotated declaration would not be type-checked, which is how Inform works today.
What's a type? At a minimum we need Number, String, Routine, Class, Dictionary, and combined types like String|Routine. Maybe specific object classes too. Can a type include "or zero"? What about "or -1"? (The library defines
NULL = -1
, and it's a valid value forbefore
.) (In fact the veneer recognizes -1 in such properties.) A list of constant values for an enum?I am not even getting into the question of how to spell these annotations.
This is difficult but potentially very helpful to authors. Inciting example:
(The library wants the
article
property to contain a string, not a dict word.)Idea mentioned in forum thread: https://intfiction.org/t/inform-6-compiler-does-not-give-error-when-article-property-uses-single-quotes/55512
The text was updated successfully, but these errors were encountered: