Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upwithCmds is more understandable than ! #661
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
process-bot
Jul 14, 2016
Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
process-bot
commented
Jul 14, 2016
|
Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it! Here is what to expect next, and if anyone wants to comment, keep these things in mind. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rtfeldman
Jul 14, 2016
Member
I think the point of ! is to reduce verbosity in an super common operation. You can always do this:
( model, Cmd.none )...but you end up writing that extremely often as your code base grows, so ! gives you a more concise way to express it:
model ! []I wouldn't use a withCmds, since it'd be more verbose than either of these!
If I didn't want to use !, I'd just fall back on the tuple style. Either works fine!
|
I think the point of ( model, Cmd.none )...but you end up writing that extremely often as your code base grows, so model ! []I wouldn't use a If I didn't want to use |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
willnwhite
Jul 14, 2016
( model, Cmd.none ) is clearer than model ! [], so I use that.
model `withCmds` [cmdA, cmdB]is less verbose (and arguably clearer) than
( model, Cmd.batch [cmdA, cmdB] )and clearer than
model ! [cmdA, cmdB]
willnwhite
commented
Jul 14, 2016
•
|
model `withCmds` [cmdA, cmdB]is less verbose (and arguably clearer) than ( model, Cmd.batch [cmdA, cmdB] )and clearer than model ! [cmdA, cmdB] |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jul 15, 2016
Member
Don't want to have PRs open for API change suggestions. I think this is viable, but I also would like to let (!) live for longer and see what happens.
|
Don't want to have PRs open for API change suggestions. I think this is viable, but I also would like to let |
evancz
closed this
Jul 15, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
willnwhite
Jul 16, 2016
I was suggesting it as an alias for (!), rather than as a replacement, but sure. I guess I should start using it in my own code first!
willnwhite
commented
Jul 16, 2016
|
I was suggesting it as an alias for |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
willnwhite
commented
Aug 19, 2016
|
|
willnwhite commentedJul 14, 2016
•
edited
Edited 1 time
-
willnwhite
edited Jul 14, 2016 (most recent)
damn haha, just realized what😍
!fromPlatform.Cmddoes, amazingMaybe
!has a history, but I think it could do with a more descriptive name.I've avoided using it so far because it's harder to understand than the alternative.
I guess shorthand is useful, but I always feel like I never know who's going to need to understand my code quickly.
maybe
withCmdsas an alias for(!). you could do{ ...model... }withCmds[cmdA, cmdB]. but then again that's something people might have to look up once and remember then too
Though that might be an even better "basic" way because it gets rid of the tuple syntax too.
I was wondering if
!was used for anything else because I thinkwithCmdslike this is the most readable.and since this is a thing... http://package.elm-lang.org/help/design-guidelines#avoid-infix-operators