Skip to content

Commit e3d23ad

Browse files
committed
Update documentation
1 parent 5c9f431 commit e3d23ad

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

doc/user/polyglot.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,14 @@ access to other languages.
2525

2626
## Running Ruby code from another language
2727

28-
When you `eval` Ruby code from the Polyglot API in another language and mark
29-
the source as interactive, the same interactive top-level binding is used each
30-
time. This means that if you set a local variable in one `eval`, you will be
31-
able to use it from the next.
32-
33-
Not that parsing Ruby is dependent on the current state of the top-level
34-
binding. If you parse an interactive source with the binding at one point in
35-
time, and then execute against the binding after it has been modified, the
36-
code will not be re-parsed with the modified binding. You may even find that
37-
you create a race condition, or parse against a binding in a state during the
38-
execution of another source.
39-
40-
To complicate this - Ruby parsing in TruffleRuby is lazy. Your code won't be
41-
parsed until it is executed for the first time.
28+
When you `eval` Ruby code from the [Context API](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Context.html)
29+
in another language and mark the `Source` as interactive, the same interactive
30+
top-level binding is used each time. This means that if you set a local variable
31+
in one `eval`, you will be able to use it from the next.
32+
33+
The semantics are the same as the Ruby semantics of calling
34+
`INTERACTIVE_BINDING.eval(code)` for every `Context.eval()` call with an
35+
interactive `Source`. This is similar to most REPL semantics.
4236

4337
## Loading code written in foreign languages
4438

0 commit comments

Comments
 (0)