Pragmatic directives: Difference between revisions

From Rosetta Code
Content added Content deleted
m (Tcl doesn't do this)
Line 1: Line 1:
{{draft task}}
{{draft task}}
[[Category:Pragmatic directives]]

Pragmatic directives cause the language to operate in a specific manner, allowing support for operational variances within the program code (possibly by the loading of specific or alternative modules).
Pragmatic directives cause the language to operate in a specific manner, allowing support for operational variances within the program code (possibly by the loading of specific or alternative modules).


Line 34: Line 34:
no strict; # disable strict pragma module</lang>
no strict; # disable strict pragma module</lang>


{{omit from|Tcl}}
[[Category:Pragmatic directives]]

Revision as of 14:56, 9 October 2011

Pragmatic directives is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Pragmatic directives cause the language to operate in a specific manner, allowing support for operational variances within the program code (possibly by the loading of specific or alternative modules).

The task is to list any pragmatic directives supported by the language, demostrate how to activate and deactivate the pragmatic directives and to describe or demonstate the scope of effect that the pragmatic directives have within a program.

Perl

By convention pragmatic modules are named using lowercase letters.

List of pragmatic modules

  • diagnostics
  • english
  • feature
  • integer
  • lib
  • ops
  • sort
  • strict
  • switch
  • warnings

Utilization

Pragmatic modules have local scope and are utilized using the use directive:

<lang perl>use warnings; # use warnings pragma module use strict; # use strict pragma module</lang>

To disable behaviour of a pragmatic module:

<lang perl>no warnings; # disable warnings pragma module no strict; # disable strict pragma module</lang>