Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do we care about the 'past' in FRP?

Tags:

When toying around with implementing FRP one thing I've found that is confusing is what to do with the past? Basically, my understanding was that I would be able to do this with a Behaviour at any point:

beh.at(x) // where time x < now

This seems like it could be problematic performance wise in a case such as this:

val beh = Stepper(0, event) // stepwise behaviour

Here we can see that to evaluate the Behaviour in the past we need to keep all the Events and we will end up performing (at worst) linear scans each time we sample.

Do we want this ability to be available or should Behaviours only be allowed to be evaluated at a time >= now? Do we even want to expose the at function to the programmer?

like image 484
seadowg Avatar asked Mar 02 '12 01:03

seadowg


People also ask

Can FRP be bypassed?

Bypass FRP Lock is a free Android app created by Techeligible that lets you bypass the Google Factory Reset Protection system on your mobile device. Even with Google Play, it prevents anyone that may have stolen your phone from wiping your data and files clean.

Why does FRP lock happen?

The FRP is enabled automatically when a Google account has been registered on the device and will be disabled if the Google account is removed from the device prior to the Factory Data Reset. Once the FRP has been activated, it will prevent use of your device after a Factory Data Reset in an untrusted environment.

What does FRP stand for Google?

Android™ devices provide built-in security features you can use to protect your device and information, including screen locks and data encryption. Data protection, or Factory Reset Protection (FRP), is a security feature on Android devices with Lollipop 5.1 and higher.


1 Answers

While a behaviour is considered to be a function of time, reliance on an arbitrary amount of past data in FRP is a Bad Thing, and is referred to as a time leak. That is, transformations on behaviours should generally be streaming/reactive in that they do not rely on more than a bounded amount of the past (and should accumulate this knowledge of the history explicitly).

So, no, at is not desirable in a real FRP system: it should not be possible to look at either the past or the future. (The latter is, of course, impossible, if the state of the future depends on anything external to the FRP system.)

Of course, this leads to the problem that only being able to look at the exact present severely restricts what you can do when writing a function to transform behaviours: Behaviour a -> Behaviour b becomes the same as a -> b, which makes many things we'd like to do impossible. But this is more an issue of finding a semantics, one of FRP's persistent problems, than anything else; as long as the primitive transformations on behaviours you provide are powerful enough without causing time leaks, everything should be fine. For more information on this, see Garbage collecting the semantics of FRP.

like image 157
ehird Avatar answered Oct 29 '22 09:10

ehird