Hi list,
| a | [ a := 3 ] valueWithTimeout: 500. [ a isNil ] whileTrue. This freezes the page, unlike the (I think) equivalent in Pharo: |a| [ (Delay forMilliseconds: 500) wait. a := 3 ] fork. [ a isNil ] whileTrue. Which waits for a to not be nil and ends. Any ideas?
Cheers! Bernat Romagosa. |
Hi,
I don't know for sure, but it looks like a scope problem. Maybe local variables in Amber cannot be addressed from within blocks? Cheers... |
In reply to this post by Bernat Romagosa
Is #fork really works in Amber?
2011/12/27 Bernat Romagosa <[hidden email]> Hi list, |
No, #fork doesn't exist in Amber, that was the equivalent code in Pharo :)
It seems to be the normal behavior in Javascript, so I'm afraid there may be no solution to get this to work in Amber.
2011/12/30 Denis Kudriashov <[hidden email]> Is #fork really works in Amber? Bernat Romagosa. |
In reply to this post by Denis Kudriashov
On Fri, 2011-12-30 at 09:17 +0400, Denis Kudriashov wrote:
> Is #fork really works in Amber? Nope, it's not at all in Amber. And #valueWithTimeout: doesn't work the same way. BTW, the same is true with JavaScript: var a; setTimeout(function() {a = 3}, 500); while(!a) {"oops"}; Cheers, Nico > > 2011/12/27 Bernat Romagosa <[hidden email]> > Hi list, > > > | a | > [ a := 3 ] valueWithTimeout: 500. > [ a isNil ] whileTrue. > > > This freezes the page, unlike the (I think) equivalent in > Pharo: > > > |a| > [ (Delay forMilliseconds: 500) wait. a := 3 ] fork. > [ a isNil ] whileTrue. > > > Which waits for a to not be nil and ends. > > > Any ideas? > > > Cheers! > > > -- > Bernat Romagosa. > > |
Maybe it would be possible to implement that with WebWorkers[1]? I believe not with considerable effort and even then only with introduced complexity to the overall system.
[1] http://en.wikipedia.org/wiki/Web_worker
On Mon, Jan 2, 2012 at 6:30 PM, Nicolas Petton <[hidden email]> wrote:
|
Web workers are like native OS threads support for usual smalltalk system.
Is it possible to implement green threads in amber? 2012/1/4 Amber Milan Eskridge <[hidden email]> Maybe it would be possible to implement that with WebWorkers[1]? I believe not with considerable effort and even then only with introduced complexity to the overall system. |
Not without significantly changing (and slowing down) Amber, since Amber is a transpiled system and not an interpreted one, IMHO.
On Wed, Jan 4, 2012 at 11:34 AM, Denis Kudriashov <[hidden email]> wrote: Web workers are like native OS threads support for usual smalltalk system. |
Free forum by Nabble | Edit this page |