Replies: 1 comment 3 replies
|
The two definitions provide overloads for different return types. LPeg pattern:match returns a number (the new position) if there are no captures; if captures are present, it returns the captured values (as a tuple) which can be any type. By defining both signatures, the Teal type checker can handle both patterns: use the stricter |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Why does
lpeg.d.tldefine LPeg'smatch()function twice? (The return types differ.)The definitions are here:
https://github.com/teal-language/teal-types/blob/master/types/lpeg/lpeg.d.tl#L36
The definitions are:
Thanks!
All reactions