———————————-
module foo
imports list-cons tuple-cons
strategies

main =
foo(!1)

foo(s : (a -> a) -> a ) =
!2
———————————-

Compile with -O 2 to prevent inlining


martin@logistico:~> strc -i foo.str -O 2
compiling foo.str
front-end succeeded: user 0.14 system 0.11
optimization succeeded: user 0.01 system 0.02
back-end succeeded: user 0.05 system 0.05
foo.c: In function main_0_0': foo.c:40: warning: passing arg 1 offoo_1_0’ from incompatible pointer type
C compilation succeeded: user 0.07 system 0.01
—–
compilation succeeded: user 0.27 system 0.19
—————————————-

This issue is related to STR-17 (Check for invalid number of term arguments). That issue is difficult to solve because the Stratego compiler does not have a proper type checker. A use of an SVar is not related to its target, which might be an higher order argument of a function. In issue STR-17, it is ok to use ‘bar’ as an argument to a higher order strategy, but not to apply ‘bar’ to a term.

Submitted on 28 May 2004 at 13:08

On 25 September 2004 at 00:40 Jira commented:

STR-97, martin:
This requires more work (see type checker)


On 9 January 2013 at 16:55 Eelco Visser removed tag 0.22

On 9 January 2013 at 16:55 Eelco Visser tagged interesting

Log in to post comments