opal icon indicating copy to clipboard operation
opal copied to clipboard

Enable async Opal startup and REPL, use correct REPL runner

Open janbiedermann opened this issue 1 year ago • 6 comments

Taken from my platform work. Use case: Conditional dynamic import() of platform specific modules directly after runtime.js and before corelib ruby parts. Lets see what specs say ...

janbiedermann avatar Oct 10 '24 11:10 janbiedermann

All good, nice.

janbiedermann avatar Oct 10 '24 11:10 janbiedermann

No, not all good, it causes issues when using eval(), eval_js()

janbiedermann avatar Oct 12 '24 19:10 janbiedermann

Actually not, the issues i hit are caused by a pending promise, a error somewhere else, so still all good.

janbiedermann avatar Oct 12 '24 19:10 janbiedermann

No, not all good, because the unresolved promise is caused by this change.

janbiedermann avatar Oct 12 '24 19:10 janbiedermann

For the moment, not queuing code for IRB solves the problem. But this needs further work to enable async code for REPL/IRB.

janbiedermann avatar Oct 13 '24 07:10 janbiedermann

Alright, all good

janbiedermann avatar Oct 13 '24 11:10 janbiedermann

My test case:

>> puts 123; p [1,2,3,4,5].each_await { |i| p i }.__await__; puts 456
123
1
2
=> #<PromiseV2:0x31e>
>> 
3
=> nil
>> 
4
=> nil
>> 
5
=> nil
>> 
=> nil
>> 
[1, 2, 3, 4, 5]
456
=> nil

Somehow it returned too early...

hmdne avatar Nov 14 '24 11:11 hmdne

@hmdne sure, i removed that await again, because if you do: >> a = Promise.new it will wait forever

janbiedermann avatar Nov 14 '24 14:11 janbiedermann