Skip to content

[FEATURE] Add support for Function Bindings #327

@Starexify

Description

@Starexify

In haxe, we can use for/while loops on maps to fill them (as documented in the Haxe Manual.

So we have this example code (comments match haxe behavior):

var map = new IntMap();
var f = map.set.bind(_, "12");

f(1);
f(2);
f(3);
trace(map.get(1)); // 12
trace(map.get(2)); // 12
trace(map.get(3)); // 12

In polymod this isn't supported and errors with the following errors:

 ERROR  Error while executing function WorstCParser.onCreate()#0:
Tried to access "_", but it is not a valid field or method.
 ERROR  Error while executing function WorstCParser.onCreate()#8:
Tried to access "bind", but it is not a valid field or method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions