twosigma / twosigma/beakerx

Why so complicated syntax for interact?

Open
#5,867 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
2.9k
Forks
383
PR merge metrics
No merged PRs in 30d

Description

I was just playing with tutorials and was fascinated by the one called `interactive`. But there is a confusing thing. Why does one have to create method then convert it to closure?

The [code](https://github.com/twosigma/beakerx/blob/0c1619506d473b87f7b2480c49b53478170bc3cb/kernel/groovy/src/main/java/com/twosigma/beakerx/groovy/widgets/Interactive.java#L34) also does not make a lot of sense. It uses `MethodClosure` instead of generic `Closure`. It could be done to use enclosing instance for the method, but:
1. It does not seem to be the case.
2. It is much better to use Closure `rehidrate` method for this purpose.

Also it is better to use closure as a last parameter, in order not to create a separate closure.

So my question is this: is this design intentional? If not, I can try to fix it and create a pull request (if I figure out developer installation, I hate working with python ecosystem).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.