Metaprogramming: Difference between revisions

Content deleted Content added
→‎E: new example
Rahul (talk | contribs)
Line 52: Line 52:
the source level, and also runtime
the source level, and also runtime
[http://software-lab.de/doc/refM.html#macro macros] are used occasionally.
[http://software-lab.de/doc/refM.html#macro macros] are used occasionally.

=={{header|PostScript}}==
PostScrpt allows the reification of stack, scoping (Dynamic scoping is default, but lexical scoping can be implemented using immediate loading), bindings using dictionaries, and even control flow. Here is an example of implementation of if statement
{{libheader|initlib}}
<lang postscript>
/ift {
4 dict begin
[/.if /.then] let*
count array astore /.stack exch def
/_restore {clear .stack aload pop}.
.stack aload pop .if {
_restore .then
} {
_restore
} ifelse
end}.
</lang>


=={{header|Python}}==
=={{header|Python}}==