diff --git a/distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Lazy.enso b/distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Lazy.enso deleted file mode 100644 index 388eb0984d0d..000000000000 --- a/distribution/lib/Standard/Base/0.0.0-dev/src/Runtime/Lazy.enso +++ /dev/null @@ -1,75 +0,0 @@ -import project.Any.Any -import project.Error.Error -import project.Nothing.Nothing -import project.Panic.Caught_Panic -import project.Panic.Panic -import project.Runtime.Ref.Ref - -## Holds a value that is computed on first access. -type Lazy - ## PRIVATE - Lazy (cached_ref : Ref) (builder : Nothing -> Any) - - ## PRIVATE - Eager (value : Any) - - ## Creates a new lazy value. - new : Any -> Lazy - new ~lazy_computation = - builder _ = lazy_computation - cached_ref = Ref.new Lazy_Not_Computed_Mark - Lazy.Lazy cached_ref builder - - ## Creates a pre-computed lazy value. - This can be useful if a value needs to admit the Lazy type API, but is - known beforehand. - new_eager value = Lazy.Eager value - - ## Returns the stored value. - - The value will be computed on first access and cached. - get : Any - get self = case self of - Lazy.Lazy cached_ref builder -> case cached_ref.get of - Lazy_Not_Computed_Mark -> - cached_value = Cached_Value.freeze builder - cached_ref.put cached_value - cached_value.get - cached_value -> cached_value.get - Lazy.Eager value -> value - -## PRIVATE - This is a special value that should never be returned from a lazy computation - as it will prevent the lazy value from being cached. -type Lazy_Not_Computed_Mark - -## PRIVATE -type Cached_Value - ## PRIVATE - Value value - - ## PRIVATE - Error error - - ## PRIVATE - Panic (caught_panic : Caught_Panic) - - ## PRIVATE - Accesses the cached value as if it was just computed - any stored errors - or panics will be propagated. - get : Any - get self = case self of - Cached_Value.Value value -> value - Cached_Value.Error error -> Error.throw error - Cached_Value.Panic caught_panic -> Panic.throw caught_panic - - ## PRIVATE - Runs the provided `builder` with a `Nothing` argument, handling any - errors or panics and saving them as a `Cached_Value`. - freeze : (Nothing -> Any) -> Cached_Value - freeze builder = - save_panic caught_panic = Cached_Value.Panic caught_panic - Panic.catch Any handler=save_panic <| - result = Cached_Value.Value (builder Nothing) - result.catch Any dataflow_error-> - Cached_Value.Error dataflow_error diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQL_Type_Reference.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQL_Type_Reference.enso index 11e02d9b82ac..033511f43281 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQL_Type_Reference.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQL_Type_Reference.enso @@ -1,6 +1,5 @@ from Standard.Base import all import Standard.Base.Errors.Illegal_State.Illegal_State -import Standard.Base.Runtime.Lazy.Lazy import project.Connection.Connection.Connection import project.Data.SQL_Type.SQL_Type @@ -14,7 +13,7 @@ type SQL_Type_Reference Since fetching this type requires querying the database, it is computed lazily and cached. - Computed_By_Database (lazy_ref : Lazy) + Computed_By_Database ~lazy_ref ## Refers to an SQL type that is overridden by the dialect's type system. Overridden (value : SQL_Type) @@ -51,7 +50,7 @@ type SQL_Type_Reference columns = connection.jdbc_connection.fetch_columns statement statement_setter only_column = columns.first only_column.second - SQL_Type_Reference.Computed_By_Database (Lazy.new do_fetch) + SQL_Type_Reference.Computed_By_Database do_fetch ## PRIVATE Creates a new `SQL_Type_Reference` that should never be used. @@ -61,7 +60,7 @@ type SQL_Type_Reference null = getter = Error.throw (Illegal_State.Error "Getting the SQL_Type from SQL_Type_Reference.null is not allowed. This indicates a bug in the Database library.") - SQL_Type_Reference.Computed_By_Database (Lazy.new getter) + SQL_Type_Reference.Computed_By_Database getter ## PRIVATE Turns this reference into a type override.