paleolimbot commented on code in PR #39:
URL: https://github.com/apache/arrow-nanoarrow/pull/39#discussion_r962080395


##########
r/R/zzz.R:
##########
@@ -0,0 +1,88 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# nocov start
+.onLoad <- function(...) {
+  s3_register("arrow::infer_type", "nanoarrow_array")
+  s3_register("arrow::as_data_type", "nanoarrow_schema")
+  s3_register("arrow::as_schema", "nanoarrow_schema")
+  s3_register("arrow::as_arrow_array", "nanoarrow_array")
+  s3_register("arrow::as_chunked_array", "nanoarrow_array")
+  s3_register("arrow::as_record_batch", "nanoarrow_array")
+  s3_register("arrow::as_arrow_table", "nanoarrow_array")
+  s3_register("arrow::as_record_batch_reader", "nanoarrow_array_stream")
+}
+
+s3_register <- function(generic, class, method = NULL) {

Review Comment:
   I'm certainly happy to do that to be safe, although this particular function 
seems like it has been licensed differently to support this sort of usage:
   
   ```
   #' @section Usage in other packages:
   #' To avoid taking a dependency on vctrs, you copy the source of
   #' 
[`s3_register()`](https://github.com/r-lib/vctrs/blob/main/R/register-s3.R)
   #' into your own package. It is licensed under the permissive
   #' [unlicense](https://choosealicense.com/licenses/unlicense/) to make it
   #' crystal clear that we're happy for you to do this. There's no need to 
include
   #' the license or even credit us when using this function.
   ```
   
   ( 
https://github.com/r-lib/vctrs/blob/c2a7710fe55e3a2249c4fdfe75bbccbafcf38804/R/register-s3.R#L25-L31
 )



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to