Skip to content

[FEATURE] Add support for Function Bindings #327

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"); // The "12" was fixed by Kolo's PR but wildcards still don't work

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions