Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| language:impl [2026/08/05 15:24] – [Overrides] rajit | language:impl [2026/08/05 15:30] (current) – [Variant overrides] rajit | ||
|---|---|---|---|
| Line 268: | Line 268: | ||
| ==== Variant overrides ==== | ==== Variant overrides ==== | ||
| + | If a process has non-strict template parameters, then variants of the process with different non-strict parameter values may need different overrides. While this is straightforward for simple instances, if an array contains a collection of process variants, then this creates a challenge in declaring an override. | ||
| + | |||
| + | To support this, consider the process below: | ||
| + | <code act> | ||
| + | template< | ||
| + | defproc addbuf(chan? | ||
| + | { | ||
| + | | ||
| + | chp { | ||
| + | *[ L?x; R!(x+VAL) ] | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | If we have different implementations of '' | ||
| + | <code act> | ||
| + | defproc impl_addbuf <: addbuf() | ||
| + | +{ | ||
| + | ... any overrides for ports here ... | ||
| + | } | ||
| + | { | ||
| + | /* the default implementation */ | ||
| + | ... | ||
| + | } | ||
| + | | addbuf< | ||
| + | /* different implementation when the non-strict parameter has value 4 */ | ||
| + | } | ||
| + | | addbuf< | ||
| + | /* different implementation when the non-strict parameter has value 8 */ | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | This variant override syntax permits variations of the implementation relation based on the specific values of the non-strict template parameters. | ||