empirical-lang icon indicating copy to clipboard operation
empirical-lang copied to clipboard

docstring support and interactive help

Open chrisaycock opened this issue 4 years ago • 0 comments

Functions can accept a docstring:

func foo(x: Int64):
  """ Some amazing notes here! """
  return x + 1
end

However, there is currently no way to retrieve it. The proposed solution is a sema_function called help(). Given an identifier, the resolved item's type and docstring are returned. This may necessitate adding an attribute to HIR's resolved so that every kind of identifier can participate.

Bonus is to add syntactic sugar to the REPL:

x?

resolves to

help(x)

chrisaycock avatar Jul 24 '20 02:07 chrisaycock