_apply

A QL Expression that will be run when you name this Thing. -- Collection: Optional Type: Function
_apply is an advanced function, and most users will not use it directly. But it is probably the most important Property in Querki, and advanced users may want to play with it.
One of Querki's design goals was that it should Just Work. This is reflected, more than anywhere else, in the fact that you can just say:
[[My Thing]]
and it shows up as a pointer to My Thing.
That seems obvious, but consider -- you can also say:
[[My Property]]
and what you get isn't a pointer to My Property -- instead, you get the value of My Property on the Thing you're looking at.
Moreover, you can say:
[[All Things]]
on a page, and what you get is a listing of all of the Things in this Space! So what the heck is going on here?
The secret behind the magic is the _apply method. _apply is a Property that is defined on every Thing. (More or less -- system-defined Things use a closely-related built-in mechanism.) It defines exactly "What should happen when I name this Thing?" So _apply on Properties displays the value of the Property on the received Thing; _apply on All Things is this QL Expression:
_currentSpace -> _externalRoots -> _sort -> _showModelTree
And _apply for Thing (the Model that everything is based on) simply produces a pointer to this thing.
You can define _apply for your own Things as well -- indeed, the way you usually write your own serious Methods is to define a Thing that just has an _apply Property, and then you can use the Method just like the system-defined ones, by name.
The QL Expression in the _apply Property will receive whatever is passed in, and should produce whatever you want to pass out. It is currently completely unstructured and untyped. However, note that we will probably be moving towards more structure in the future, and you should always try to be consistent: as with any QL Expression, you should expect to receive a specific Type, and always produce a specific Type.

Things that use _apply