scarpe-team / scarpe

Scarpe - shoes but running on webview
Other
163 stars 29 forks source link

Shoes incompatibility: code after Shoes.app is not executed #231

Closed noahgibbs closed 1 year ago

noahgibbs commented 1 year ago

I haven't found any examples where this matters. But if you use a binary build of Shoes3, code after Shoes.app is executed, while with Scarpe (at least with Webview) it isn't, because the "run" event in Shoes.app never returns, so control never really leaves that method call.

Example:

Shoes.app do
  $p = para "Hello, world"
end

$p.replace "Yo, made it here!"

The replace happens in Shoes3, but not in current Scarpe.

We may want a whole "incompatibility with Shoes" category, maybe in the Wiki. In the mean time, I'm filing as issues.

noahgibbs commented 1 year ago

There are some ways we could fix this, even with Webview.

Shoes Classic runs like an old-style X server - it runs one loop for all your stuff, and loads other apps as chunks of widgets into it. That could be done, though I have stability worries about it.

We could use at_exit and display when the Ruby app would otherwise finish. There are some down-sides -- nothing would get shown until control got to the end of the file, for instance.

There's also that Fiber thing I've mentioned, where we execute the Shoes block and handlers inside one or more Fibers. Then control could get past Shoes.app inside a Fiber. Not 100% sure how we'd handle the run loop, but we'd have that problem with everything, not just code after the Shoes.app call.

None of these approaches strikes me as a slam-dunk good thing with no problems. So it's not clear we want to fix this.

Schwad commented 1 year ago

Oo that is wild and neat that it can run outside of the block in Shoes3. Imagine the crazy things a developer could do!

It might matter for larger shoes apps like Hackety that might leverage that? But cheers for raising this

noahgibbs commented 1 year ago

I figure it's good for us to have a list somewhere, especially of the ones we probably won't fix all that soon.

noahgibbs commented 1 year ago

This isn't likely to change any time soon, so I'm just adding it to the wiki. We can reopen this or file a new issue if we decide we care about fixing it later.

Wiki: https://github.com/scarpe-team/scarpe/wiki/ScarpeIncompatibilities.md