Pragmatic directives: Difference between revisions
Content added Content deleted
PatGarrett (talk | contribs) (→{{header|PL/I}}: Section added) |
|||
Line 299: | Line 299: | ||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |
||
PicoLisp makes no formal difference between any normal and "specific" operation of the language. Any possible desired effect can be achieved by calling a function or setting a variable. For example, function calls can be traced with the '[http://software-lab.de/doc/refT.html#trace trace]' function. |
PicoLisp makes no formal difference between any normal and "specific" operation of the language. Any possible desired effect can be achieved by calling a function or setting a variable. For example, function calls can be traced with the '[http://software-lab.de/doc/refT.html#trace trace]' function. |
||
/* {{header|PL/I}} */ Section added -- Superfluous blanks suppressed |
|||
=={{header|PL/I}}== |
|||
Disabled on-conditions can be seen as pragmatic directives. |
|||
<br>SubscriptRange (SUBRG), StringRange (STRG), StringSize (STRZ), Size conditions |
|||
can be enabled for a PROCEDURE or a BEGIN block. |
|||
<br>By default, for optimization reasons, |
|||
SubscriptRange,StringRange,StringSize,Size are disabled. |
|||
<br>If enabled the SubscriptRange condition is raised for out-of-bound subscript of |
|||
an array. |
|||
For example: |
|||
<lang pli> |
|||
declare (t(100),i) fixed binary; |
|||
i=101; |
|||
t(i)=0; |
|||
</lang> |
|||
will cause unpredictible results. |
|||
And : |
|||
</lang> |
|||
<lang pli> |
|||
(SubscriptRange): begin; |
|||
declare (t(100),i) fixed binary; |
|||
i=101; |
|||
t(i)=0; |
|||
end; |
|||
</lang> |
|||
will issue the message : "The SubscriptRange condition was raised." at execution time. |
|||
Or, it can be handle by an on-unit. |
|||
<lang pli> |
|||
(SubscriptRange): begin; |
|||
declare (t(100),i) fixed binary; |
|||
i=101; |
|||
on SubscriptRange begin; put skip list('error on t(i)'); goto e; end; |
|||
t(i)=0; |
|||
e:on SubscriptRange system; /* default dehaviour */ |
|||
end; |
|||
</lang> |
|||
<br>And the same way for a string, |
|||
the StringRange condition is raised when a substring reference is beyond |
|||
the span of the string. |
|||
<br>And finally. |
|||
The StringSize condition is raised when a string is shorten |
|||
as a result of a convertion assigment. |
|||
The Size condition is raised when a numerical value is shorten |
|||
as a result of a convertion assigment. |
|||
=={{header|Python}}== |
=={{header|Python}}== |