JoshOrndorff / LearnRholangByExample

Teaches rholang to beginners and intermediate programmers through hands-on examples and experimentation.
67 stars 32 forks source link

airportInfo outside #51

Open guilhermehas opened 4 years ago

JoshOrndorff commented 4 years ago

Ahh, good catch. This is indeed a bug. Your fix makes the code run and display the expected output, but it has the nasty side effect that any listener to the airport info can also change it. ATC won't like that.

How about this

// Controllers create new station with private set capability
// and public get capability
new airportInfo in {
  new set in {
    stationFactory!("Weather is nice", *airportInfo, *set)
  }
  |
  // Listener tunes in to receive latest message
  airportInfo!(*stdout)
}
guilhermehas commented 4 years ago

I think this works