Is it possible to define macros
write_foo(A);
and
read_foo();
so that:
WRITE_FOO(hello);
code_block_1;
READ_FOO();
code
this is the sweet spot for tools like Cog that approach the problem of code generation from an intuitive programming approach using python. This is what would look like your code using it
/*[[[cog
# definitions ----
import cog
Foo = ''
def WriteFoo( value ):
Foo = value
def ReadFoo():
cog.outl(' %s; ' % Foo)
# generation ---
WriteFoo( 'hello' )
]]]*/
//[[[end]]]
some_code_block;
/*[[[cog
ReadFoo() ]]]*/
hello;
//[[[end]]]
some_other_blocK;
/*[[[cog
WriteFoo( 'world')
ReadFoo() ]]]*/
world;
//[[[end]]]
last_block;