-
Notifications
You must be signed in to change notification settings - Fork 0
Property type
Jonathan edited this page Aug 30, 2018
·
1 revision
Firefly has a special type called Property, this type encapsulates properties and manage the storage and access of values. Properties commonly abstracts field access and definition, but could also abstract the access and definition of remote values, such as database values, file stored values, etc...
The access to a property value is simple:
val nameProp: Property<name: String> = ...;
val name = nameProp.get() //Result<String, Error>
The get method returns a Result because it is not guaranteed that the value still accessible or could be retrieved.
The definition is a bit more complex
val nameProp: Property<name: String> = ...;
val set: SetOp<Property<String>> = nameProp.set()
set.to("hello") // Resulr<Op, Error>