This works by translating it to a $size() system function call. The $size function is already implemented for dynamic queues and it is easy enough to expand it for queues.