bakpakin / Fennel

Lua Lisp Language
https://fennel-lang.org
MIT License
2.42k stars 124 forks source link

[Stdlib] Add type check macros #470

Open alexmozaidze opened 9 months ago

alexmozaidze commented 9 months ago

Having simple macros like string?, number?, table?, nil?, etc. would increase the readability of code that may use them.

The only thing I'm worried about is the existing table? in macro context. iirc, it checks if an AST node is a table literal, as opposed to runtime type of table. I think it wouldn't be unreasonable to rename AST checking macros to be: table-literal?, sequence-literal?, etc.

technomancy commented 9 months ago

The big problem here is that it will almost certainly conflict with existing identifiers in a large number of existing codebases. Until we have a mechanism to opt in to new built-in macros, I don't think we can introduce these as it will be a breaking change.