Why are actions called msg? Is there any reason for keeping this? I know that (and actually use) they can be renamed, as it's just a "conventional name".
I'd vote for changing it to actions though, assuming that there's nothing I'm missing of course.
Yep. I'm for that too and thinking it from day one. It is just more typing and i kinda feel i'm starting to like msg because it is short.
From the Elm examples.
update msg model =
case msg of
Increment ->
model + 1
Decrement ->
model - 1
Notice that HyperApp does not export a msg prop, so you're free to use another name, alternative ones I considered:
The problem with those is that they are verbs and HyperApp prefers:
msg.actionName(...)
as opposed to
msg("actionName", ...)
If you browse the git history (IIRC it should still be there), you'll find that the msg object was implemented in a way that supported both styles above, but I felt that would be a hub of confusion, so I chose the one that does not use "strings" to send actions.
Another good alternative is:
not use "strings" to send actions.
and
msg.actionName(...)
Yep. That's another thing that I like in hyperapp. Feels better than the choo's alternative send('actionName') - too much typing.
Yeah, it's not a big deal though. I'm pretty choo could implement this as well, but they already went with the other style, which is okay.
yeah, I like the ideas that do not use "strings" to send actions like redux actually do.
but I personally think msg is not a good name for a container that keeps all the action , which you called "reducers", and effects in. both reducers and effects both describe some kind of "transformation" or "actions" . maybe these two would be better to understand, And you can make it to "trans" or "acs" for shorter typing.
@liadbiz I think the best name is action, that's how they are described in the docs and the wiki as well. I just used msg to mimic Elm conventions. This is just a documentation change, since HyperApp itself does not know anything about a msg property.
@jbucaran right. just better comprehensible.
@jbucaran I'd say plural is more appropriate here, otherwise it implies that there is only one action per effect/view.
@dodekeract I would like to clarify, so as to make sure we're all on the same page here, that HyperApp is not aware of any msg named property. This is just a regular identifier for an object that is the result of merging reducers and effects. You can use the name you find more approachable.
@jbucaran I was under the impression that you read my inital comment. I'm not retarded, it's obvious that hyperapp can't know the name of the variable in those cases. I'm simply suggesting that the docs should use the plural form instead of singular.
Plural yea. actions is great.
@dodekeract I didn't imply you were retarded lmao. Funny. I've renamed it to actions both in the docs and internally! I should be releasing a new version tonight.
EDIT: Keep in mind that while I did @ mention you in my reply, this is not just a conversation between you and me. These discussions, albeit informally, document the history of the project.
Docs have been updated to reflect the change in the terminology. Code was updated as well to remove any reference to msg. If you find any, please let us know or send a PR.
msg → actions