blocking_mutate
concur.blocking_mutate
Constructors
(T type):Mutable_Array T, mutate.this,mutable_element is[Inherited from mutate][Private constructor]¶
(T
type
):
Mutable_Array T, mutate.this,mutable_element is
[Inherited from mutate]
[Private constructor]
¶create a mutable array.
(T type):Mutable_Array2 T, mutate.this,mutable_element is[Inherited from mutate][Private constructor]¶
(T
type
):
Mutable_Array2 T, mutate.this,mutable_element is
[Inherited from mutate]
[Private constructor]
¶create a mutable array with two dimensions.
(T type):Mutable_Array3 T, mutate.this,mutable_element is[Inherited from mutate][Private constructor]¶
(T
type
):
Mutable_Array3 T, mutate.this,mutable_element is
[Inherited from mutate]
[Private constructor]
¶create a mutable array with three dimensions.
(T type) ref:Circular_Buffer T, mutate.this,mutable_element is[Inherited from mutate][Private constructor]¶
(T
type
) ref
:
Circular_Buffer T, mutate.this,mutable_element is
[Inherited from mutate]
[Private constructor]
¶create a circular buffer.
buffer to which elements can be enqueued and retrieved with a FIFO
logic.
backed by a fixed length array.
buffer to which elements can be enqueued and retrieved with a FIFO
logic.
backed by a fixed length array.
common type for mutable data
create a new mutable value with the given initial value and update the
'mutate' effect in the current environment
'mutate' effect in the current environment
Functions
does this effect support abort?
fluent interface for using multiple effects together
this effect reinterpreted as a Functional
which allows composition of effects
which allows composition of effects
create a String from this instance. Unless redefined, `a.as_string` will
create `"instance[T]"` where `T` is the dynamic type of `a`
create `"instance[T]"` where `T` is the dynamic type of `a`
dynamic_apply -- apply `f.call` to `Any.this`'s dynamic type and value
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
perform given code with exclusive access to the mutable values created with
this instance of `mutate`.
this instance of `mutate`.
exclusively wait for the given condition to hold and then perform given code with
exclusive access to the mutable values created with this instance of `mutate`.
exclusive access to the mutable values created with this instance of `mutate`.
cleanup feature to destroy mutex and other resources associated with this
effect.
NYI: UNDER DEVELOPMENT: Ensure that this does not get redefined by user
code.
effect.
NYI: UNDER DEVELOPMENT: Ensure that this does not get redefined by user
code.
infix variant instate_self
use it like this:
use it like this:
convenience version of `instate` for effect values whose type is
exactly the effect type (i.e., the value type does not inherit
from the effect type).
Execute 'code' in a context where this effect instance has been
instated for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, this will panic.
exactly the effect type (i.e., the value type does not inherit
from the effect type).
Execute 'code' in a context where this effect instance has been
instated for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, this will panic.
check if the current thread is permitted to access mutable state managed by mutate.this
exclusively.
For a single-thread mutate, this is usually the case for the same thread this mutate was
created in. Furthermore, multi-thread mutate implementations may ensure exclusive
access to other threads via redefining the `exclusive` features.
exclusively.
For a single-thread mutate, this is usually the case for the same thread this mutate was
created in. Furthermore, multi-thread mutate implementations may ensure exclusive
access to other threads via redefining the `exclusive` features.
is instance `mutate.this` instated for type `mutate.this` and, if `mutate.this` does
not support use in several threads, check we are running in the thread `mutate.this`
was created in?
not support use in several threads, check we are running in the thread `mutate.this`
was created in?
convenience feature for creating a new array,
in some cases even with type inference
in some cases even with type inference
(T type, length0 i64, length1 i64, init T) => container.Mutable_Array2 T mutate.this[Inherited from mutate]¶
(T
type
, length0 i64, length1 i64, init T) =>
container.Mutable_Array2 T mutate.this[Inherited from mutate]
¶convenience feature for creating a new array2,
in some cases even with type inference
in some cases even with type inference
convenience feature for creating a new array3,
in some cases even with type inference
in some cases even with type inference
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
replace existing effect of type `effect.this` by the new effect value `effect.this`.
This is a convenience feature for value type effects for which the type of
the effect instance equals the effect type. `ref` type effects typically have
values that may be children of the effect type that are of a different type, so
`effect_type.replace new_value` must be used.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
This is a convenience feature for value type effects for which the type of
the effect instance equals the effect type. `ref` type effects typically have
values that may be children of the effect type that are of a different type, so
`effect_type.replace new_value` must be used.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
wait for the given condition to become true by a mutation of the underlying data.
In case this mutate is not a multi-thread implementation and `condition()` is `false`,
this will `panic`.
In case this mutate is not a multi-thread implementation and `condition()` is `false`,
this will `panic`.
Type Functions
Abort code execution for the instated effect.this.env and return to the point
where the effect was instated.
where the effect was instated.
replace existing effect for type `effect.this` by the new effect value `e`
and abort code execution to return to the point where the effect was instated.
and abort code execution to return to the point where the effect was instated.
string representation of this type to be used for debugging.
result has the form "Type of '<name>'", but this might change in the future
result has the form "Type of '<name>'", but this might change in the future
If this effect may be instated automatically at application start (during the
effect big bang singularity), this should be redefined to return the
corresponding effect value
effect big bang singularity), this should be redefined to return the
corresponding effect value
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
get this effect from env
has an effect of the given type been instated?
Is this type assignable to a type parameter with constraint `T`?
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
infix variant of effect.instate
use it like this:
use it like this:
execute 'code' in a context where the effect instance `e` has been
installed for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, this will panic.
installed for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, this will panic.
(R type, e effect.this.type, code Function R, def Unary R effect.this.type) => R[Inherited from effect]¶
(R
type
, e effect.this.type, code Function R, def Unary R effect.this.type) =>
R[Inherited from effect]
¶execute 'code' in a context where the effect instance `e` has been
installed for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, return `def()`.
installed for effect type `effect.this`.
In case `f` returns normally, this will return `f`'s result.
In case `f` aborts this effect, return `def()`.
has an effect of this type been instated?
name of this type, including type parameters, e.g. 'option (list i32)'.
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
replace existing effect for type `effect.this` by the new effect value `e`.
For effects that model the outside world (e.g., i/o, time, sensors and actuators, etc.),
the effect might be a unit type, so the replace is effectively a no-operation. However,
the call to `replace` is used ot model the change of the outside world and must be
included for analysis tools to appreciate this.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
NYI: BUG: It is currently not enforced that replace is only called during the execution
of an operation of a currently instated effect of the same effect type.
For effects that model the outside world (e.g., i/o, time, sensors and actuators, etc.),
the effect might be a unit type, so the replace is effectively a no-operation. However,
the call to `replace` is used ot model the change of the outside world and must be
included for analysis tools to appreciate this.
replace may only be called during the execution of an operation of a currently instated
effect of the same effect type.
NYI: BUG: It is currently not enforced that replace is only called during the execution
of an operation of a currently instated effect of the same effect type.
Get a type as a value.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
0.095dev (GIT hash fe578dbae82d257bfb6d755e3b05abbf37247dbe)
This mutate ensure exclusive access to shared memory via using locks and
blocking.
Accidental race accesses are not permitted by this mutate, i.e., accessing
mutable elements, e.g, via `get` or `put` on a mutable var `mutate.new T`,
are not permitted unless we are in code run via
`blocking_mutate.this.exclusive`.