Thank you. All of my videos are in playlists, and I wish that UA-cam had a feature where they automatically linked to playlists that the creators of videos place the videos in. I've requested it, but it hasn't happened. The main playlist for this video is ua-cam.com/play/PLLMXbkbDbVt98z_6KWt3fU3W5jTOja9zY.html. It is also part of a much longer playlist that covers a semester of material.
You are very welcome. I hope that it proves useful to you. If you go to my channel, you should be able to see all of the playlists that I have on various topics.
I’ve seen some scala code that does things like: val someA = something.createSomeA(....) Future { someA.doSomething1(....) someA.doSomething2(.....) } // some other expressions I don’t really understand what the future is doing in this case as it’s not assigned to anything. Could someone explain what the Future is doing here?
Code that looks like this is simply interested in the side effects of the methods doSomething1 and doSomething2, and wants them to happen in a separate thread. Spawning a Future is probably the easiest way to make something happen in a separate thread in Scala, so this isn't uncommon, even if you have no interest in the result of the Future.
Line : f2.onComplete { onComplete method is abstract in trait Future.......how is it possible to call like you are doing in this code ? Please give some tips
When we create the Future, we actually get some subtype of Future. That subtype has the method implemented. I need to go back through these videos. It is advised to use foreach instead of onSuccess. I need to make certain I did that.
I don't know. I have never gone to look. You could go into the source for the scala.concurrent.Future companion object and see what the apply method returns. It actually comes from the implicit execution context that you are using, so that probably won't give you the answer you are looking for. I would argue that you really shouldn't know that in general, and that if you ever write code that depends on a particular implementation, you are doing something bad that will make your code brittle.
Good explanation just as I thought
What is the next video? Could you PLZ make a playlist of the related videos
Thank you. All of my videos are in playlists, and I wish that UA-cam had a feature where they automatically linked to playlists that the creators of videos place the videos in. I've requested it, but it hasn't happened. The main playlist for this video is ua-cam.com/play/PLLMXbkbDbVt98z_6KWt3fU3W5jTOja9zY.html. It is also part of a much longer playlist that covers a semester of material.
Playlist saved (y)
Thank you so much
You are very welcome. I hope that it proves useful to you. If you go to my channel, you should be able to see all of the playlists that I have on various topics.
I’ve seen some scala code that does things like:
val someA = something.createSomeA(....)
Future {
someA.doSomething1(....)
someA.doSomething2(.....)
}
// some other expressions
I don’t really understand what the future is doing in this case as it’s not assigned to anything. Could someone explain what the Future is doing here?
Code that looks like this is simply interested in the side effects of the methods doSomething1 and doSomething2, and wants them to happen in a separate thread. Spawning a Future is probably the easiest way to make something happen in a separate thread in Scala, so this isn't uncommon, even if you have no interest in the result of the Future.
Line : f2.onComplete {
onComplete method is abstract in trait Future.......how is it possible to call like you are doing in this code ? Please give some tips
When we create the Future, we actually get some subtype of Future. That subtype has the method implemented.
I need to go back through these videos. It is advised to use foreach instead of onSuccess. I need to make certain I did that.
ok Thanks.....Where is source code for that Concrete class Future, I mean which File .
I don't know. I have never gone to look. You could go into the source for the scala.concurrent.Future companion object and see what the apply method returns. It actually comes from the implicit execution context that you are using, so that probably won't give you the answer you are looking for. I would argue that you really shouldn't know that in general, and that if you ever write code that depends on a particular implementation, you are doing something bad that will make your code brittle.