# Proposal: Command Syntax

**URL:** <https://es.discourse.group/t/proposal-command-syntax/1716>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [May 27, 2023, 7:41pm UTC](https://es.discourse.group/t/proposal-command-syntax/1716 "2023-05-27T19:41:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![theScottyJam](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/thescottyjam/32/616_2.png) [@theScottyJam](https://es.discourse.group/u/theScottyJam)\
**Post date:** [May 28, 2023, 3:28pm UTC](https://es.discourse.group/t/proposal-command-syntax/1716/5 "2023-05-28T15:28:43Z")

</div>

I would like some clarification on this point:

> [@mlanza](#):
>
> anything which strikingly calls out the distinction between pure (queries) and impure (commands) is welcome.

So, is a function like this a command or a query?

```javascript
function getUserInfo(userId) {
  return fetch(`https://${HOST}/users/${encodeURIComponent(userId)}`)
    .then(res => res.json());
}

```

It's not changing the state of the system, rather, it's just querying an external resource. But, it does perform a side-effect (it sends out an HTTP request) in order to perform that query, and so it is not a pure function.

Reading various online resources, it feels like a function like this is supposed to be interpreted as a query (not a command), but those same online resources like to use the terminology "no side-effects" or "impure" to describe queries, which if we took those statements literally, it would mean that the above should be interpreted as a command. I suspect they were just using the terms "side-effect" and "pure" more loosely than how it's traditionally defined. But, I want to check to see how you're defining a command and query, and if you really mean command==impure and query==pure.

If so, there is at least one other thread I know of, that discussed differentiating between pure and impure functions, along with some runtime enforcement of it, that may be applicable to this discussion: [Add pure function modifier, build Hoogle equivalent](https://es.discourse.group/t/add-pure-function-modifier-build-hoogle-equivalent/1535)

---

_[View the full topic](https://es.discourse.group/t/proposal-command-syntax/1716)._
