refaktor / rye

homoiconic dynamic programming language with some new ideas
https://ryelang.org
Apache License 2.0
406 stars 21 forks source link

isolate not isolating as documented #281

Closed cwarden closed 1 month ago

cwarden commented 1 month ago

Following the isolate example from the documentation:

x> ok-printer: isolate { pr: ?print p: ?prn }
[Context (isolate!): pr: [BFunction(1): Prints a value and adds a newline.] p: [BFunction(1): Prints a value without newline.] ]
x> msg: "WT?"
[String: WT?]
x> do\in ok-printer { pr msg }
WT?
[String: WT?]

ok-printer shouldn't have access to msg, but does as of c0e3948077c804815deca81bbcdcc1376d767428.

refaktor commented 1 month ago

Hm ... you are correct. There were some design/name changes around fn\in fn\par fn\cc that affected do\in and do\inside ... that changed this. I have to think about the naming and ways and make it consistent and document it. Thank you for noticing!

Do\in became something new, like fn\par is, but do\inside would be what was do\in. "Inside" was temporary and we will probably have do\par and do\in so docs will be in sync again.

refaktor commented 1 month ago

Have made the renames. do\in is again do\in (was do\inside) ... latest do\in became do\par which has the same behavior as fn\par. It evaluates do in current context with given context as a parent (replacing the previous parent context). So you get access to msg in your example yes, but not for example to any of the not passed in built-ins.

https://github.com/refaktor/rye/pull/289

Thank you!