I have some pattern functions and pure function in my package. If i set attributes Protected
and ReadProtected
. My pattern function definition is hidden from end user but for pure function just evaluating its name prints its definition. I believe pure function are storing their definition as OwnValues
as opposed to DownValues
. Is there a way i can make them available for use but hide their definition?
$\begingroup$
$\endgroup$
f = Function[x, x^2]; SetAttributes[f, ReadProtected]; ?? f
and you see that also theOwnValues
off
are hidden fromDefinition
andFullDefinition
. Butf
will always evaluate to aFunction
and of course, one can see what it does. $\endgroup$ – Henrik Schumacher Jun 14 '18 at 13:22ReadProtected
does not really protect from reading. My favorite example isNeeds["GeneralUtilities`"];PrintDefinitions[HighlightGraph]
. $\endgroup$ – Henrik Schumacher Jun 14 '18 at 15:35