Skip to content

Function objects as classes with an apply() method #2

@cpfr

Description

@cpfr

Function declarations can easily be expressed as objects like the following:

ReturnType funName(parameters):
    body

funName(arguments)

is translated into

class CfunName:
    + ReturnType apply(parameters):
        body

CfunName funName := CfunName()
funName.apply(arguments)

In order to also allow this for local functions, local classes have to be allowed as well (see issue #1 ).

Open question: how are methods translated? --> literature review

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions