Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| language:types2 [2026/08/05 15:23] – [Non-strict template parameters] rajit | language:types2 [2026/08/09 13:10] (current) – [Non-strict template parameters] rajit | ||
|---|---|---|---|
| Line 153: | Line 153: | ||
| the type. Hence, when checking for type compatibility, | the type. Hence, when checking for type compatibility, | ||
| parameters are also taken into account. Hence, the full type for | parameters are also taken into account. Hence, the full type for | ||
| - | instance '' | + | instance '' |
| '' | '' | ||
| parameters are more completely specified as '' | parameters are more completely specified as '' | ||
| Line 463: | Line 463: | ||
| ... | ... | ||
| </ | </ | ||
| - | This will also result in the same circuit as the earlier example, because the value '' | + | This will also result in the same circuit as the earlier example, because the value '' |
| What if we wanted to create an array of these adders? While | What if we wanted to create an array of these adders? While | ||
| Line 481: | Line 481: | ||
| New type: addbuf< | New type: addbuf< | ||
| </ | </ | ||
| - | This is because elements of an array must have the same type. As this is a useful use-case, ACT has special syntax that can be used to support | + | This is because elements of an array must have the same type. As this is a useful use-case, ACT has support |
| Template parameters for processes can be of two types: | Template parameters for processes can be of two types: | ||
| - | * //strict// parameters, are the ones we have been considering so far. | + | * //strict// parameters, |
| * // | * // | ||
| - | Any ports for the type can only use strict parameters. | ||
| - | Non-strict parameters are separate | + | |
| + | Non-strict parameters are separated | ||
| <code act> | <code act> | ||
| template< | template< | ||
| Line 505: | Line 505: | ||
| </ | </ | ||
| ACT will allow this syntax. This comes with a few caveats: | ACT will allow this syntax. This comes with a few caveats: | ||
| - | * The array will be treated as a sparse array with multiple chunks, each of which can have different non-strict parameters. | + | |
| + | template< | ||
| + | defproc oddbuf(chan? | ||
| + | { | ||
| + | ... | ||
| + | } | ||
| + | </ | ||
| + | -[ERROR]-> | ||
| + | </ | ||
| + | * Even if the array is dense, it will be treated as a sparse array with multiple chunks | ||
| * Sub-array expressions cannot be used where different elements have different types. | * Sub-array expressions cannot be used where different elements have different types. | ||
| + | |||
| + | Since the general ACT syntax can be used, the following would also be valid: | ||
| + | <code act> | ||
| + | ... | ||
| + | (i:8: addbuf< | ||
| + | ... | ||
| + | </ | ||
| + | |||