@@ -115,6 +115,27 @@ namespace Rcpp{
115115 }
116116 return res ;
117117 }
118+
119+ /* *
120+ * Get an object from the environment
121+ *
122+ * @param name symbol name to call
123+ *
124+ * @return a SEXP (possibly R_NilValue)
125+ */
126+ SEXP get (Symbol name) const {
127+ SEXP env = Storage::get__ () ;
128+ SEXP res = Rf_findVarInFrame ( env, name ) ;
129+
130+ if ( res == R_UnboundValue ) return R_NilValue ;
131+
132+ /* We need to evaluate if it is a promise */
133+ if ( TYPEOF (res) == PROMSXP){
134+ res = Rf_eval ( res, env ) ;
135+ }
136+ return res ;
137+ }
138+
118139
119140 /* *
120141 * Get an object from the environment or one of its
@@ -136,6 +157,29 @@ namespace Rcpp{
136157 }
137158 return res ;
138159 }
160+
161+ /* *
162+ * Get an object from the environment or one of its
163+ * parents
164+ *
165+ * @param name symbol name to call
166+ */
167+ SEXP find (Symbol name) const {
168+ SEXP env = Storage::get__ () ;
169+ SEXP res = Rf_findVar ( name, env ) ;
170+
171+ if ( res == R_UnboundValue ) {
172+ // Pass on the const char* to the RCPP_EXCEPTION_CLASS's
173+ // const std::string& requirement
174+ throw binding_not_found (name.c_str ()) ;
175+ }
176+
177+ /* We need to evaluate if it is a promise */
178+ if ( TYPEOF (res) == PROMSXP){
179+ res = Rf_eval ( res, env ) ;
180+ }
181+ return res ;
182+ }
139183
140184 /* *
141185 * Indicates if an object called name exists in the
0 commit comments