Very, very simply, according to quantum physics, something is not one specific thing until observed. My idea is that Swift could have "quantum" variables that are computed and run an asynchronous function before they are read. This could look like:
Future.swift
import Foundation
@main
var thisVarBecomesRandomEveryNanosecond: Int = 0
quantum var exampleQuantumVariable: Int {
get async {
// ...
return thisVarBecomesRandomEveryNanosecond
}
}
for(1..100) {_ in
print("\(exampleQuantumVariable)") // `exampleQuantumVariable` changes at this point
}
Why not just use a computed property?
var randomInteger: Int {
Int.random(in: Int.min...Int.max)
}
for _ in 0..<100 {
print(randomInteger)
}
2 Likes
filiplazov
(Filip Lazov)
3
isn't that just async version of lazy ?
4 Likes
Yes. I don’t know how hours of research could let me miss this.
1 Like