| | 236 | |
| | 237 | == Implementation == |
| | 238 | |
| | 239 | I don't think it's possible to implement the scope-parameterized constructs by translating the program to one without the scope parameters. |
| | 240 | |
| | 241 | The reason is that if there is a cycle in the call graph, you may need an infinite number of non-scope-parameterized procedures. |
| | 242 | Here is an example. |
| | 243 | |
| | 244 | Original program outline: |
| | 245 | {{{ |
| | 246 | | <t1> void f(int *<t1> x); |
| | 247 | | | scope s1 |
| | 248 | | | g<s1>(...) |
| | 249 | | <t2> void g(int *<t2> y); |
| | 250 | | | scope s2 |
| | 251 | | | f<s2>(...) |
| | 252 | | main() { f<s0>(...); } |
| | 253 | }}} |
| | 254 | |
| | 255 | Attempt to expand scope-parameterized procedures statically: |
| | 256 | |
| | 257 | {{{ |
| | 258 | | f0(s0) |
| | 259 | | | scope s1.0 |
| | 260 | | | g<s1.0> |
| | 261 | | g0(s1.0) |
| | 262 | | | scope s2.0 |
| | 263 | | | f<s2.0> |
| | 264 | | f2(s2.0) |
| | 265 | | | scope s1.1 |
| | 266 | | | g<s1.1> |
| | 267 | | g1 |
| | 268 | etc. |
| | 269 | }}} |
| | 270 | |