# The name "cmake\_command" is overloaded

**URL:** https://discourse.cmake.org/t/the-name-cmake-command-is-overloaded/1238
**Category:** Development
**Created:** [May 19, 2020, 9:48pm UTC](https://discourse.cmake.org/t/the-name-cmake-command-is-overloaded/1238 "2020-05-19T21:48:05Z")
**Posts on this page:** 1
**Showing post:** 13

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 20, 2020, 11:20am UTC](https://discourse.cmake.org/t/the-name-cmake-command-is-overloaded/1238/13 "2020-05-20T11:20:26Z")

</div>

> [@marc.chevrier](#):
>
> `if (item() AND item)`

CMake’s command parser and variable parsers are two completely separate things. The first is an unnecessarily complicated lax/yacc generated thing that does balanced parentheses, comment, and quote/square brackets computations to find the last parenthesis. This returns a command name and a string to split into arguments `cmMakefile::ExpandVariableInString` then takes the argument list and expands arguments where some other routine then picks up and splits it into actual arguments (with quoting information). This proposed syntax would need to merge these somehow which seems…unlikely. Given CMake’s wonky argument semantics, is this allowed?

```cmake
function (thought_experiment)
  return (somevar STREQUAL)
endfunction ()

if (though_experiment() "a string")
  message("hmm")
else ()
  message(
    "functions can't return lists? "
    "returned lists are not expanded at their use site? "
    "what is the exception here? "
    "is this just another `if` special case? why?")
endif ()

```

So I think any such real-world collision has far more problems than the name collision to consider. The syntax parser would hopefully have which is which be 100% unambiguous anyways (`if` is a bit special here, but any other variable naming occurs within a `$key{` style expansion, so _that_ should be unambiguous. You probably lose on `${thought_experiment()}`, but even that may be an acceptable future since `()` are invalid characters in literal variable names today anyways:

```cmake
set("thought_experiment()" value)
set(varname "thought_experiment()")
set(expanded "${varname}") # expands to "value"

```

But explaining the difference between the above and `${though_experiment()}` is going to be tricky, so probably not the best idea.

---

_[View the full topic](https://discourse.cmake.org/t/the-name-cmake-command-is-overloaded/1238)._
