Awaiting Futures (in Scala)

Поділитися
Вставка
  • Опубліковано 29 лис 2024

КОМЕНТАРІ • 7

  • @subodhrathi9512
    @subodhrathi9512 Рік тому

    Hi @MarkLewis I tried similar example with number as 50 for fib function using onComplete and the main thread completed before printing the result. If I understood from this video, my future should have waited to receive the value or an exception. Am I missing something? Most of the times, we would need a value from future to do something; hence is Await the only possible option and how should one determine the timeout window?

  • @ridakejji6837
    @ridakejji6837 4 роки тому +1

    Wonderful tutorial thank you !

  • @SarathChandranZ
    @SarathChandranZ 8 років тому

    you could avoid the duration error by importing `import scala.language.postfixOps`

    • @MarkLewis
      @MarkLewis  8 років тому +1

      Yes, but I generally just put a dot as the postfix notation is now frowned upon.

    • @SarathChandranZ
      @SarathChandranZ 8 років тому

      matter of personal taste :)

    • @MarkLewis
      @MarkLewis  8 років тому

      Yes, but it used to just be part of the language. Then they changed it so that it took a compiler flag or an import. In many ways, I like how it reads, but I think it causes issues for the parsing of the language. For that reason, I think they would like to deprecate it. I don't expect it to be an option on Dotty. I guess I could pull down Dotty and try, but I haven't had the motivation for that yet. I have to finish the book that this video is associated with in the next few days before I can play with other stuff.