« Return to Thread: future hangs

Re: future hangs

by Marcus Downing :: Rate this Message:

Reply to Author | View in Thread

Is removing Application sufficient? The idiom that Application embodies is bound to happen again in other people's code. Shouldn't either the creation or accessing of the future throw an exception, if called from within a constructor?


Ricky Clarkson wrote:
Yet again, "let's remove Application".

2009/7/8 Detering Dirk <Dirk.Detering@bitmarck.de>:
> Nice subject ...
>
>> This simple application hangs at "println(s())". Apparently,
>> the mistake is so simple that I cannot find it... what am I
>> doing wrong? Defining getData and printing s() in the
>> interactive scala shell works just fine. Thanks!
>>
>> object Test extends Application {
>>
>>     val s = future(getData("AAPL\n"))
>>     val t = getData("INTC\n")
>>     println(t) // that's fine
>>     println(s()) // hangs here
>
> Well, the println(s()) will first wait for the result of s,
> but -due to the definition of s- that doesn't come now, but
> in future.
>
> Due to the functional aspect, this is true for every point in time.
>
> (I would recommend renaming the val s into val godot,
> and then putting the println(godot()) into a method called
> "mañana"...).
>
>
> Ðet
>
>
> PS: No, I'm NOT stressed, Mum!!!!
>



--
Ricky Clarkson
Java Programmer, AD Holdings
+44 1565 770804
Skype: ricky_clarkson
Google Talk: ricky.clarkson@gmail.com

 « Return to Thread: future hangs