Introspection: Difference between revisions

Line 944:
 
<code>abs</code> is a method of the Math object, methods are properties, and the <code>in</code> operator tests whether an object has the named property.
 
=={{header|jq}}==
jq's powers of introspection are currently very limited, being
essentially confined to the built-in function `builtins`, which
as the name suggests only yields information about built-in filters (name and arity).
 
Version information can however be made available to a running jq program as illustrated here:
 
jq --arg version $(jq --version) '$version'
 
References to undefined functions and undefined variables (that is jq's "$-variables")
are regarded as errors that cannot be caught, but in a pinch one can use the
technique illustrated here:
 
jq -n --argjson bloop null 'if $bloop then $bloop|length else "undefined" end'
 
As it happens, jq's "abs" function is named "length" (don't ask why),
so the task regarding `abs()` cannot really be accomplished using the name `abs`.
 
=={{header|Jsish}}==
2,507

edits