Skip to content

Feature request: Java-like local inner classes? #1807

Closed
@qc00

Description

@qc00

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions