Re: When to use ! in function name

2014-07-11 Thread Softaddicts
You do not reuse log file output to propagate state changes. If you do I would like to know for what purpose... In my world the ultimate goal of log file output is human consumption with or without aggregation or alert filtering. It has nothing to do with your system internal state. It's merely

Re: When to use ! in function name

2014-07-11 Thread Cecil Westerhof
2014-07-11 14:28 GMT+02:00 Stefan Kamphausen : > On Friday, July 11, 2014 11:33:34 AM UTC+2, Cecil Westerhof wrote: >> >> 2014-07-10 19:10 GMT+02:00 Softaddicts : >> >> ​but as I understood from others it is not about side-effects, but global >> state. >> > > as James and I already pointed out, th

Re: When to use ! in function name

2014-07-11 Thread Cecil Westerhof
2014-07-11 14:19 GMT+02:00 Softaddicts : > I look at side effects this way, will it ever record some state change > that some > code in the universe will eventually rely on ? > > If no, then there's no state change/side effect to care about. > > Sending a message is a side effect (a pgm will event

Re: When to use ! in function name

2014-07-11 Thread Stefan Kamphausen
Hi, On Friday, July 11, 2014 11:33:34 AM UTC+2, Cecil Westerhof wrote: > > 2014-07-10 19:10 GMT+02:00 Softaddicts >: > ​but as I understood from others it is not about side-effects, but global > state. > as James and I already pointed out, that is not what it is about. The bang is about int

Re: When to use ! in function name

2014-07-11 Thread Softaddicts
I look at side effects this way, will it ever record some state change that some code in the universe will eventually rely on ? If no, then there's no state change/side effect to care about. Sending a message is a side effect (a pgm will eventually use it), writing to a database, ... qualify.

Re: When to use ! in function name

2014-07-11 Thread Cecil Westerhof
2014-07-11 11:28 GMT+02:00 Stefan Kamphausen : > On Friday, July 11, 2014 11:10:53 AM UTC+2, Cecil Westerhof wrote: >> >> 2014-07-10 18:34 GMT+02:00 Plínio Balduino : >> >> IMO, ! is used when change any global state. A side effect like print on >>> screen is not enough to cause a ! in the name. I

Re: When to use ! in function name

2014-07-11 Thread Cecil Westerhof
2014-07-10 19:10 GMT+02:00 Softaddicts : > The fn that does the display is the one having side effects. > Now if your look fn creates the side effect, it should reflect that in its > name. > ​Look discribes the current location. So it has a side-effect, but as I understood from others it is not a

Re: When to use ! in function name

2014-07-11 Thread Stefan Kamphausen
Hi, On Friday, July 11, 2014 11:10:53 AM UTC+2, Cecil Westerhof wrote: > > 2014-07-10 18:34 GMT+02:00 Plínio Balduino >: > >> IMO, ! is used when change any global state. A side effect like print on >> screen is not enough to cause a ! in the name. I think that's why the >> functions print/prin

Re: When to use ! in function name

2014-07-11 Thread Cecil Westerhof
2014-07-10 18:46 GMT+02:00 Stefan Kamphausen : > On Thursday, July 10, 2014 5:28:26 PM UTC+2, Cecil Westerhof wrote: >> >> When a function returns a true/false value you should end it with a '?'. >> >> Clojure Programming says that with side effects you should end the >> function name with a '!'.

Re: When to use ! in function name

2014-07-11 Thread Cecil Westerhof
2014-07-10 18:34 GMT+02:00 Plínio Balduino : > IMO, ! is used when change any global state. A side effect like print on > screen is not enough to cause a ! in the name. I think that's why the > functions print/println don't have ! =) > ​Than I did it in the 'right' way. In the book the where talk

Re: When to use ! in function name

2014-07-10 Thread Softaddicts
The fn that does the display is the one having side effects. Now if your look fn creates the side effect, it should reflect that in its name. But... I wonder why it does so. Looking at something does not change state. You may be better splitting the side effect away from it or change the name. Lo

Re: When to use ! in function name

2014-07-10 Thread James Reeves
In clojure.core, an ending "!" indicates a function that is unsafe for STM, rather than one with side effects. For instance, alter and send are functions with side effects, but have no ending "!" because they're safe to use in a dosync block. In other words, an ending "!" indicates a function has

Re: When to use ! in function name

2014-07-10 Thread Stefan Kamphausen
On Thursday, July 10, 2014 5:28:26 PM UTC+2, Cecil Westerhof wrote: > > When a function returns a true/false value you should end it with a '?'. > > Clojure Programming says that with side effects you should end the > function name with a '!'. > "Use the bang! only for things not safe in an STM

Re: When to use ! in function name

2014-07-10 Thread Plínio Balduino
IMO, ! is used when change any global state. A side effect like print on screen is not enough to cause a ! in the name. I think that's why the functions print/println don't have ! =) Plínio On Thu, Jul 10, 2014 at 12:28 PM, Cecil Westerhof wrote: > When a function returns a true/false value yo

When to use ! in function name

2014-07-10 Thread Cecil Westerhof
When a function returns a true/false value you should end it with a '?'. Clojure Programming says that with side effects you should end the function name with a '!'. I have functions reset-game! and walk!. But what about a function like look? It does not change state, but it displays where you ar