kailua icon indicating copy to clipboard operation
kailua copied to clipboard

Documentation requests

Open lifthrasiir opened this issue 7 years ago • 0 comments

The following is a (incomplete) list of collected issues or deficiencies (that is, documented but not very visible) on the current language documentation. Some of them are directly related to the language shortcoming as well. Short answers are provided.

  • [ ] How does WHATEVER differ from any? WHATEVER ignores the checking while any will be no way usable in the checking. By using any you force the usage of assume (which is safer than WHATEVER).
  • [ ] How can I specify types for variadic arguments? Using string.format as an example: --v function(fmt: string, ...: any) --> string, or ... --: any on the declaration. Note the symmetry.
  • [ ] Why can't I omit any argument? It will accept an explicit nil value but you need any? to omit any arguments.
  • [ ] How can I use union types? T | U. You will need --# assume to destructure it.
  • [ ] How can I use nilable types? T?. You can explicitly assign it to T, or --# assume to get rid of nil.
  • [ ] How can I use "modules"? Any table can be declared with --: module to enable the delayed type checking against its methods.
  • [ ] Can I use --: module against classes? Yes, e.g. SomeClass = class() --: module.
  • [ ] How can I use [make_class]? Normally via --# assume. You can also use [make_class] with [NO_CHECK] functions. The resulting function should be appropriately typed (currently function() --> any).
  • [ ] How can I represent the lack of return type? --> () or use --v form. (When --v is not in use, the missing return type will be inferred.) If your function never returns, use --> !.
  • [ ] How can I specify types for each fields in the table? Currently you need to use the whole type for the entire table: a = { x = 1, y = 2 } --: { x: integer, y: integer }.

lifthrasiir avatar May 05 '17 09:05 lifthrasiir