Pragmatic directives: Difference between revisions

Content deleted Content added
→‎{{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:
::* &nbsp; NUMERIC DIGITS &nbsp; {nnn}
::* &nbsp; NUMERIC FORM &nbsp; &nbsp; {ENGINEERING | SCIENTIFIC}
::* &nbsp; NUMERIC FUZZ &nbsp; &nbsp; &nbsp; {nnn}
::* &nbsp; OPTIONS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {xxx yyy zzz}
::* &nbsp; TRACE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {options}

===numeric digits===
The &nbsp; '''NUMERIC DIGITS nnn''' &nbsp; 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''' &nbsp; can be an expression that evaluates to a
positive integer.

If &nbsp; '''nnn''' &nbsp; is omitted, it defaults to &nbsp; '''9'''.

If no &nbsp; '''numeric digits''' &nbsp; statement is used, &nbsp; the
default for REXX programs is &nbsp; '''9'''.

It must be greater than the
(current) &nbsp; '''NUMERIC FUZZ''' &nbsp; setting.

===numeric fuzz===
The &nbsp; '''NUMERIC FUZZ nnn''' &nbsp; statement is used to
specify to the REXX interpreter how many
<br>decimal digits &nbsp; (at
full precision) &nbsp; will be ignored while performing an arithmetic
<br>comparison.

'''nnn''' &nbsp; can be an expression that evaluates to a
non-negative integer.

If &nbsp; '''nnn''' &nbsp; is omitted, it defaults to &nbsp; '''0'''.

If no &nbsp; '''numeric fuzz''' &nbsp; statement is used, &nbsp; the
default for REXX programs is &nbsp; '''0'''.

It must be less than the
(current) &nbsp; '''NUMERIC DIGITS''' &nbsp; setting.

The result of using a positive value for &nbsp; '''FUZZ''' &nbsp; is
that the REXX interpreter (temporarily) reduces
<br>the number of &nbsp; '''NUMERIC DIGITS''' &nbsp; by
the &nbsp; '''FUZZ''' &nbsp; value before an arithmetic comparison.

This means that arithmetic comparisons are performed with the precision of
<br>'''DIGITS()''' &nbsp; minus &nbsp; '''FUZZ()''' &nbsp; where:
::::* &nbsp; DIGITS() &nbsp; is the value of &nbsp; '''numeric digits'''
::::* &nbsp; FUZZ() &nbsp; &nbsp; is the value of &nbsp; '''numeric fuzz'''

===numeric form===
The &nbsp; '''NUMERIC FORM''' &nbsp; statement is used to
cause the REXX interpreter to use a specific form of
<br>exponential format &nbsp; if &nbsp; the result of an arithmetic
operation requires the use of exponential notation
<br>with the current value of &nbsp; '''numeric digits'''.

The specification option after &nbsp; '''numeric form''' &nbsp; can be:
::::* &nbsp; ENGINEERING
::::* &nbsp; SCIENTIFIC
::::* &nbsp; (or omitted)

The default is &nbsp; '''scientific'''.

The option can be in upper/lower/mixed case.

If no &nbsp; '''numeric form''' &nbsp; statement is used, &nbsp; the
default for REXX programs is &nbsp; '''scientific'''.

===options===
The &nbsp; '''OPTIONS''' &nbsp; 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 &nbsp; ''double byte character strings'' &nbsp;
<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 &nbsp; (or none).

Each particular REXX interpreters have their
own &nbsp; '''options''', &nbsp; 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 &nbsp; ''command-line'' &nbsp;
<br>(also known as the &nbsp; ''C.L.'').

===trace===
The &nbsp; '''TRACE''' &nbsp; statement is used to cause the REXX
interpreter to turn &nbsp; ''off'' &nbsp; or ''on'' &nbsp; certain tracing
<br>facilities for the REXX interpreter.

Most tracing options causes some sort of &nbsp; (tracing of statements
or values of clauses) &nbsp; 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 &nbsp; '''trace''' &nbsp; instruction, and they won't be explained here.


=={{header|Tcl}}==
=={{header|Tcl}}==