Closed
Description
Since functions can be defined in and returned from function bodies, it seems inconsistent to not support the definition of classes in functions. It would be very useful in applications where explicit typing of ad-hoc return value is preferred over duck typing.
The syntax and semantics could be the same as defining a class in a module (since a module is compiled to a function) with different lexical scope. Java-specific features like anonymous inner class is probably not useful due to duck typing.