diff --git a/ml.cpp b/ml.cpp index 084ec26..1db1db1 100644 --- a/ml.cpp +++ b/ml.cpp @@ -1708,7 +1708,7 @@ bool MlEnvironment::has(std::string name) const { } // Get the value associated with this name in this scope -MlValue MlEnvironment::get(std::string name) const { +MlValue MlEnvironment::get(const std::string& name) const { // Meta operations if (name == "eval") return MlValue("eval", builtin::eval); if (name == "type") return MlValue("type", builtin::get_type_name); @@ -1790,7 +1790,7 @@ MlValue MlEnvironment::get(std::string name) const { std::map::const_iterator itr = defs.find(name); if (itr != defs.end()) return itr->second; - else if (parent_scope != NULL) { + else if (parent_scope != nullptr) { itr = parent_scope->defs.find(name); if (itr != parent_scope->defs.end()) return itr->second; else return parent_scope->get(name); diff --git a/ml.h b/ml.h index e5d8036..10da210 100644 --- a/ml.h +++ b/ml.h @@ -28,7 +28,7 @@ public: // creating a lambda function. bool has(std::string name) const; // Get the value associated with this name in this scope - MlValue get(std::string name) const; + MlValue get(const std::string& name) const; // Set the value associated with this name in this scope void set(std::string name, MlValue value);