1\function{_featurep} 2\synopsis{Test whether or not a feature is present} 3\usage{Int_Type _featurep (String_Type feature [,String_Type namespace])} 4\description 5 The \sfun{_featurep} function returns a non-zero value if the specified 6 feature is present. Otherwise, it returns 0 to indicate that the feature 7 has not been loaded. 8\seealso{require, provide} 9\done 10 11\function{provide} 12\synopsis{Declare that a specified feature is available} 13\usage{provide (String_Type feature [,String_Type namespace])} 14\description 15 The \sfun{provide} function may be used to declare that a "feature" has 16 been loaded into the specified namespace. If the namespace argument is not 17 present, the current namespace will be used. 18 See the documentation for \sfun{require} for more information. 19\seealso{require, _featurep} 20\done 21 22\function{require} 23\synopsis{Make sure a feature is present, and load it if not} 24\usage{require (feature [,namespace [,file]])} 25#v+ 26 String_Type feature, namespace, file; 27#v- 28\description 29 The \sfun{require} function ensures that a specified "feature" is present. 30 If the feature is not present, the \sfun{require} function will attempt to 31 load the feature from a file. If the \exmp{namespace} argument is present 32 and non-NULL, the specified namespace will be used. The default is to use 33 the current non-anonymous namespace. If called with three arguments, the 34 feature will be loaded from the file specified by the third argument 35 if it does not already exist in the namespace. Otherwise, the feature 36 will be loaded from a file given by the name of the feature, with 37 ".sl" appended. 38 39 If after loading the file, if the feature is not present, 40 a warning message will be issued. 41\example 42#v+ 43 require ("histogram"); 44 require ("histogram", "foo"); 45 require ("histogram", "foo", "/home/bob/hist.sl"); 46 require ("histogram", ,"/home/bob/hist.sl"); 47#v- 48\notes 49 "feature" is an abstract quantity that is undefined here. 50 51 A popular use of the \sfun{require} function is to ensure that a specified 52 file has already been loaded. In this case, the feature is the 53 filename itself. The advantage of using this mechanism over using 54 \ifun{evalfile} is that if the file has already been loaded, \sfun{require} 55 will not re-load it. 56\seealso{provide, _featurep, evalfile} 57\done 58