This repository was archived by the owner on Jun 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Documentation requestsΒ #5
Copy link
Copy link
Open
Labels
Description
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
WHATEVERdiffer fromany?WHATEVERignores the checking whileanywill be no way usable in the checking. By usinganyyou force the usage ofassume(which is safer thanWHATEVER). - How can I specify types for variadic arguments? Using
string.formatas an example:--v function(fmt: string, ...: any) --> string, or... --: anyon the declaration. Note the symmetry. - Why can't I omit
anyargument? It will accept an explicitnilvalue but you needany?to omit any arguments. - How can I use union types?
T | U. You will need--# assumeto destructure it. - How can I use nilable types?
T?. You can explicitly assign it toT, or--# assumeto get rid of nil. - How can I use "modules"? Any table can be declared with
--: moduleto enable the delayed type checking against its methods. - Can I use
--: moduleagainst 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 (currentlyfunction() --> any). - How can I represent the lack of return type?
--> ()or use--vform. (When--vis 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 }.
JamesKim2998