Cmd is short for Command.

This is similar to an envelope you return to the postman. You are not
actually doing the sending, you are just returning it to the postman. It is
the job of the postman (runtime) to do something with it. They might send
it or they might trash it based on some criteria.

Cmd Msg just says that if executed, this command will produce a Msg and
that Msg will get back into the Elm Architecture.

If you are coming from an imperative language, it is very important to
understand that in Elm programs nothing gets "sent" or "done" or whatever
imperative word might come into your mind. Everything is data and
everything is evaluated to some form of data.

Some of this data, like Cmd, contains instruction for execution and the
runtime will be able to use these instructions to actually do the things
you want (like requesting something from a server) but all this happens in
the runtime not in you program.



On Wed, Jun 1, 2016 at 7:51 AM, 诺铁 <[email protected]> wrote:

> hi,
>
> at first, Cmd Msg seems to me like sending a Msg out as a Cmd, but after a
> while I understand it's saying: we send a request to something, and will
> get back a Msg in the future.  seems similar to Future Msg in some other
> languages.
>
> what doesn't the name "Cmd" mean here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to