Skip to content

improve error trapping if use <- in defining a class method #154

@paciorek

Description

@paciorek

If one accidentally has myfun <- nFunction(, in defining the first method in, say, Cpublic, there is a semi-helpful R6 message:

Error in R6::R6Class(classname = "nClass_6_Cpub_uncompiled", public = c(Cpublic,  : 
  All elements of public, private, and active must be named.

But if done in a later method:

> nc <- nClass(
    Cpublic = list(
        fun0 = nFunction(
            fun = function(x = 'numericVector',y='numericScalar') {
                return(x*y)
            }, returnType = 'numericVector'),
        fun1 <- nFunction(
            fun = function(x = 'numericVector',y='numericScalar') {
                return(x*y)
            }, returnType = 'numericVector')
    ))
Error in NF@internals : 
  no applicable method for `@` applied to an object of class "NULL"

We should probably trap this better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions