Form elements are often separate from field widgets, yet they implement very similar functionality.
Sometimes, their functionality also creep across the two apis, such as in this question: Is displaying a working Field Widget Form on its own possible?
It seems logical to me that a field widget could be a form element, that also happens to map directly to some underlying storage, especially since form api was already in place when field api came about.
I'm wondering why this is not the case.
Edit: As pointed out by kiamlaluno below, according to the official docs, widgets are Form API elements, which means I need to edit my question a little.
I came about wondering about this, because I wanted to use the Core tagging widget as a form element. To the best of my knowledge however, there is no easy way of doing that. Despite the docs claiming widgets are elements, that does not seem to necessarily be true.
If a widget was declared as
function hook_widget_info() {
return array('my_widget' => array(
'base element' => 'some_form_element_machine_name',
))
}
then the element definition would be separate from the widget, so that it could be used on both ways, but currently this is not the case.
Edit 2: Feature request opened.