There are times when you want to dynamically generate the value of an option using a dataset or other Evaluatable object. This is most often useful when using a dataset that someone else wrote.
Currently, a similar ability exists in the Map type, but only when iterating over the result of an Evaluatable that returns an interable.
The most natural way to do this would probably be to extend the WithOptions type (which powers the Dataset.with_options method) so that you can provide dynamic options as well as static ones. For example
from labrea import dataset, Option
@dataset
def foo(bar: str = Option("BAR")) -> str:
return bar
@dataset
def bar(msg: str = Option("MSG")) -> str:
return msg
foo.with_options({"BAR": bar}).evaluate({"MSG": "Hello World!"})
# 'Hello World!'