Pragmatic directives: Difference between revisions
Content deleted Content added
m →{{header|Perl 6}}: update |
→{{header|REXX}}: added the REXX language. |
||
Line 277: | Line 277: | ||
Racket eschews pragmas that are specified outside of the language. However, one can view Racket's <tt>#lang</tt> mechanism as a much more powerful tool for achieving similar things. For example, normal code starts with <tt>#lang racket</tt> -- giving you a very Scheme-like language; change it to <tt>#lang typed/racket</tt> and you get a similar language that is statically typed; use <tt>#lang lazy</tt> and you get a Racket-like language that has lazy semantics; use <tt>#lang algol60</tt> and you get something that is very different than Racket. (And of course, you can implement your own language quite easily.) |
Racket eschews pragmas that are specified outside of the language. However, one can view Racket's <tt>#lang</tt> mechanism as a much more powerful tool for achieving similar things. For example, normal code starts with <tt>#lang racket</tt> -- giving you a very Scheme-like language; change it to <tt>#lang typed/racket</tt> and you get a similar language that is statically typed; use <tt>#lang lazy</tt> and you get a Racket-like language that has lazy semantics; use <tt>#lang algol60</tt> and you get something that is very different than Racket. (And of course, you can implement your own language quite easily.) |
||
=={{header|REXX}}== |
|||
The REXX language has five pragmatic statements: |
|||
::* NUMERIC DIGITS {nnn} |
|||
::* NUMERIC FORM {ENGINEERING | SCIENTIFIC} |
|||
::* NUMERIC FUZZ {nnn} |
|||
::* OPTIONS {xxx yyy zzz} |
|||
::* TRACE {options} |
|||
===numeric digits=== |
|||
The '''NUMERIC DIGITS nnn''' statement is used to specify |
|||
to the REXX interpreter how many |
|||
<br>(significant) decimal digits |
|||
are to be used in calculating and storing numbers. |
|||
'''nnn''' can be an expression that evaluates to a |
|||
positive integer. |
|||
If '''nnn''' is omitted, it defaults to '''9'''. |
|||
If no '''numeric digits''' statement is used, the |
|||
default for REXX programs is '''9'''. |
|||
It must be greater than the |
|||
(current) '''NUMERIC FUZZ''' setting. |
|||
===numeric fuzz=== |
|||
The '''NUMERIC FUZZ nnn''' statement is used to |
|||
specify to the REXX interpreter how many |
|||
<br>decimal digits (at |
|||
full precision) will be ignored while performing an arithmetic |
|||
<br>comparison. |
|||
'''nnn''' can be an expression that evaluates to a |
|||
non-negative integer. |
|||
If '''nnn''' is omitted, it defaults to '''0'''. |
|||
If no '''numeric fuzz''' statement is used, the |
|||
default for REXX programs is '''0'''. |
|||
It must be less than the |
|||
(current) '''NUMERIC DIGITS''' setting. |
|||
The result of using a positive value for '''FUZZ''' is |
|||
that the REXX interpreter (temporarily) reduces |
|||
<br>the number of '''NUMERIC DIGITS''' by |
|||
the '''FUZZ''' value before an arithmetic comparison. |
|||
This means that arithmetic comparisons are performed with the precision of |
|||
<br>'''DIGITS()''' minus '''FUZZ()''' where: |
|||
::::* DIGITS() is the value of '''numeric digits''' |
|||
::::* FUZZ() is the value of '''numeric fuzz''' |
|||
===numeric form=== |
|||
The '''NUMERIC FORM''' statement is used to |
|||
cause the REXX interpreter to use a specific form of |
|||
<br>exponential format if the result of an arithmetic |
|||
operation requires the use of exponential notation |
|||
<br>with the current value of '''numeric digits'''. |
|||
The specification option after '''numeric form''' can be: |
|||
::::* ENGINEERING |
|||
::::* SCIENTIFIC |
|||
::::* (or omitted) |
|||
The default is '''scientific'''. |
|||
The option can be in upper/lower/mixed case. |
|||
If no '''numeric form''' statement is used, the |
|||
default for REXX programs is '''scientific'''. |
|||
===options=== |
|||
The '''OPTIONS''' statement is used to specify |
|||
to the REXX interpreter on such matters on how to |
|||
<br>process the source (statements), possibly (for instance) whether or |
|||
not ''double byte character strings'' |
|||
<br>are present, or possible |
|||
cause the REXX interpreter to force compliance to some particular rule or |
|||
<br>REXX (program) coding standards. |
|||
There can be any number of options listed (or none). |
|||
Each particular REXX interpreters have their |
|||
own '''options''', so it isn't considered an error if some |
|||
<br>option isn't supported (or recognized) by another REXX interpreter. |
|||
Some options are global in nature, others can be enabled and disabled. |
|||
Some REXX interpreters also have a way to specify certain options via |
|||
the ''command-line'' |
|||
<br>(also known as the ''C.L.''). |
|||
===trace=== |
|||
The '''TRACE''' statement is used to cause the REXX |
|||
interpreter to turn ''off'' or ''on'' certain tracing |
|||
<br>facilities for the REXX interpreter. |
|||
Most tracing options causes some sort of (tracing of statements |
|||
or values of clauses) to be |
|||
<br>emitted to the console (terminal). |
|||
The output (tracing information) written to the terminal is usually |
|||
quite distinctive and can be easily |
|||
<br>recognized. |
|||
There are a number of options for |
|||
the '''trace''' instruction, and they won't be explained here. |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |