code: func New(options ...func(r *Rego)) *Rego {
  
  	r := &Rego{
  		capture:         map[*ast.Expr]ast.Var{},
  		compiledQueries: map[queryType]compiledQuery{},
  	}
  
  	for _, option := range options {
  		option(r)
  	}
  
  	if r.compiler == nil {
  		r.compiler = ast.NewCompiler()
  	}
  
  	if r.store == nil {
  		r.store = inmem.New()
  	}
  
  	if r.metrics == nil {
  		r.metrics = metrics.New()
  	}
  
  	if r.instrument {
  		r.instrumentation = topdown.NewInstrumentation(r.metrics)
  	}
  
  	if r.trace {
  		r.tracebuf = topdown.NewBufferTracer()
  		r.tracers = append(r.tracers, r.tracebuf)
  	}
  
  	if r.partialNamespace == "" {
  		r.partialNamespace = defaultPartialNamespace
  	}
  
  	return r
  }
docs: // New returns a new Rego object.