.Load <- function(..., pattern_dim = NULL) {#, variable_dim = , 
                  #file_dimnames = 
                  #return_vars = , default_transform = ) {
  dim_params <- list(...)
  # Split *_var parameters
  var_params_ind <- grep('_var$', names(dim_params))
  var_params <- dim_params[var_params_ind]
  # Check all *_var are NULL or vectors of character strings, and 
  # that they all have a matching dimension param.
  i <- 1
  for (var_param in var_params) {
    if (!is.null(var_param)) {
      if (!is.character(var_param)) {
        stop("All '*_var' parameters must be vectors of character strings or NULL.")
      } else if (!any(grepl(paste0('^', strsplit(names(var_params)[i], 
                                                 '_var$')[[1]][1], '$'),
                            names(dim_params)))) {
        stop(paste0("All '*_var' parameters must be associated to a dimension parameter. Found parameter '", 
                    names(var_params)[i], "' but no parameter '", 
                    strsplit(names(var_params)[i], '_var$')[[1]][1], "'."))
      }
    }
    i <- i + 1
  }
  # Split *_transform parameters
  trans_params_ind <- grep('_transform$', names(dim_params))
  trans_params <- dim_params[trans_params_ind]
  # Check all *_transform are NULL or functions, and that they all have 
  # a matching dimension param.
  i <- 1
  for (trans_param in trans_params) {
    if (!is.null(trans_param)) {
      if (!is.function(trans_param)) {
        stop("All '*_transform' parameters must be functions or NULL.")
      } else if (!any(grepl(paste0('^', strsplit(names(trans_params)[i], 
                                                 '_transform$')[[1]][1], '$'),
                            names(dim_params)))) {
        stop(paste0("All '*_transform' parameters must be associated to a dimension parameter. Found parameter '", 
                    names(trans_params)[i], "' but no parameter '", 
                    strsplit(names(trans_params)[i], '_transform$')[[1]][1], "'."))
      }
    }
    i <- i + 1
  }
  # Leave alone the dimension parameters
  if (length(c(var_params_ind, trans_params_ind)) > 0) {
    dim_params <- dim_params[-c(var_params_ind, trans_params_ind)]
  }
  dim_names <- names(dim_params)
  # Make the keys of 'var_params' and 'trans_params' to be the name of 
  # the corresponding dimension.
  names(var_params) <- gsub('_var$', '', names(var_params))
  names(trans_params) <- gsub('_transform$', '', names(trans_params))

  # Check pattern_dim
  if (is.null(pattern_dim)) {
    print(paste0("Parameter 'pattern_dim' not specified. Taking the first dimension, '", 
                 dim_names[1], "' as 'pattern_dim'."))
    pattern_dim <- dim_names[1]
  }
  ## TODO: Check all specifications in pattern_dim are valid
  ##



  list(dim_params, dim_names, var_params, trans_params)
}
