Skip to content

Commit 182fcf1

Browse files
committed
Document that methods can be written for vec_ptype()
1 parent 465faa9 commit 182fcf1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

R/type.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
#' See [internal-faq-ptype2-identity] for more information about
4040
#' identity values.
4141
#'
42+
#' For performance, when developing a new S3 class you might want to override
43+
#' the default behavior of `vec_ptype()`, which is to call `vec_slice(x, 0L)`.
44+
#' To do this, write a `vec_ptype()` S3 method for your class. The method should
45+
#' return a result equivalent to `vec_slice(x, 0L)`, but for many classes this
46+
#' is a static object.
47+
#'
4248
#' Because it may contain unspecified vectors, the prototype returned
4349
#' by `vec_ptype()` is said to be __unfinalised__. Call
4450
#' [vec_ptype_finalise()] to finalise it. Commonly you will need the

man/vec_ptype.Rd

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)