The version with is
is a shortcut when the only feature called on the loop cursor is item
. The shortcut removes the need to call the query explicitly. So, the following two versions are semantically equivalent:
across foo as x loop ... x.item ... end
across foo is x loop ... x ... end
In other words, the second version could be seen as automatically translated into
across foo as _x loop ... _x.item ... end
where _x
is inaccessible and x
stands for _x.item
.
The type of x
in the first version is ITERATION_CURSOR [G]
. In the second version, it is the type of {ITERATION_CURSOR [G]}.item
, i.e. G
.
In fact, the type of the cursor is derived from the type of query new_cursor
called on the object on which the iteration is performed. However, any additional features available in this cursor type are accessible only when using the complete iteration form of a loop with as
and are inaccessible when using the shortcut form with is
.