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

Reimplement translation of cell expressions written in external languages #334

nokome opened this Issue Aug 31, 2017 · 1 comment


None yet
1 participant
Copy link

nokome commented Aug 31, 2017

In our first prototype of Stencila Sheets, all cell expressions were written in an external language (e.g. R or Python), and we translated them from a mixed spreadsheet/external languages expression e.g.

= mean(B2:B4)

to a pure external language expression:

= mean(c(B2,B3,B4)) 

This was done by regex-based processing of the cell expression combined with language-specific translation of a cell range (ie. generation of c(B2,B3,B4) for R and [B2,B3,B4] for Python)

This worked because previously we had global execution of expressions in execution contexts. Our new execution model allows an alternative (probably better) approach to this.

With the callCode method of execution contexts we can send several inputs which are local to the code. So, in the cell engine we can replace expressions like B2:B4 with a local variable name, marshall the values into an array of values and send that to the callCode method. e.g. a cell expression

= mean(B2:B4)

would be equivalent to a r() cell of:


which roughly ultimately gets executed as

rContext.callCode('mean(b2b4)', {b2b4: [1.2,1.3,1.5]})

Issue #157 is related to this.

@nokome nokome added the what:sheets label Aug 31, 2017


This comment has been minimized.

Copy link

nokome commented Nov 13, 2017


@nokome nokome closed this Nov 13, 2017

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