Is it possible to type-hint variables and return values of functions in Hy language?
# in python we can do this
def some_func() -> str:
return "Hello World"
Is it possible to type-hint variables and return values of functions in Hy language?
# in python we can do this
def some_func() -> str:
return "Hello World"
Yes... Hy implements PEP 3107 & 526 annotations since at least 8 Oct 2019 (see this pull request: https://github.com/hylang/hy/pull/1810)
There is the
#^form as in the example below (from the documentation: https://docs.hylang.org/en/master/api.html?highlight=annotation##^)and also the extended form
annotatemacro. There is also theofmacro (detailed here https://hyrule.readthedocs.io/en/master/index.html#hyrule.misc.of):