Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to define JS functions as Tcl procs #8

Closed
uatuko opened this issue Oct 31, 2015 · 9 comments
Closed

Make it possible to define JS functions as Tcl procs #8

uatuko opened this issue Oct 31, 2015 · 9 comments

Comments

@uatuko
Copy link
Member

uatuko commented Oct 31, 2015

This was asked in issue 1 and would be a handy thing to have.

e.g

// javascript function reference
var multiply = function ( x, y ) {
    return (x * y);
};

// define a Tcl proc 
tcl.proc( 'multiply', multiply );

// usage
tcl.$.set( 'x', '[multiply 10 20]' );

Discussion points

  • How would this look like for the asynchronous interfaces (eval() and queue())?
@ekarak
Copy link
Collaborator

ekarak commented Nov 16, 2015

should also target anonymous functions, such as:

tcl.proc('multiply', function(x,y) {
    return (x*y);
});

@ekarak
Copy link
Collaborator

ekarak commented Nov 16, 2015

One advanced concept I'd find interesting would be to couple Tcl's event loop with ES6 promises.
Thus, heavy/time consuming/external system JS calls functions returning Promises would yield control immediately back to Tcl's interpreter and maybe fire vwait's on the Promise result

@ekarak
Copy link
Collaborator

ekarak commented Nov 27, 2015

OK, starting work on this beast of a feature. I find this idiom a bit redundant though:
tcl.proc('multiply', multiply)
How bout
tcl.expose(multiply)
or
tcl.expose(multiply).as('multiply')

@uatuko
Copy link
Member Author

uatuko commented Nov 27, 2015

I wouldn't mind tcl.expose(multiply).as('multiply') and agree it looks nicer 😄 (not sure how tcl.expose(multiply) would work though).

@uatuko
Copy link
Member Author

uatuko commented Nov 27, 2015

@ekarak, if you are going to work on this please assign it to yourself.

@ekarak
Copy link
Collaborator

ekarak commented Nov 27, 2015

I can't :) need permissions probably.
I've forked and I'm working on my own repo anyway.

@uatuko
Copy link
Member Author

uatuko commented Nov 27, 2015

Sorted...

@uatuko
Copy link
Member Author

uatuko commented May 22, 2017

@ekarak, are you still working on this?

@uatuko uatuko mentioned this issue Jan 12, 2022
@uatuko
Copy link
Member Author

uatuko commented Jan 21, 2022

Implemented in #15

@uatuko uatuko closed this as completed Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants