Re: Could method calls warn in void context?

2015-01-11 Thread Carl Mäsak
...It could also be taken as a subtle suggestion to write unit tests, in which case you would discover such logical bugs within one red/green/refactor iteration. ;-) // Carl On Sat, Jan 10, 2015 at 10:12 PM, Gabor Szabo wrote: > > > On Sat, Jan 10, 2015 at 11:02 PM, Moritz Lenz wrote: >> >> To

Re: Could method calls warn in void context?

2015-01-10 Thread Gabor Szabo
On Sat, Jan 10, 2015 at 11:02 PM, Moritz Lenz wrote: > To elaborate a bit on the previous answer: > > On 10.01.2015 17:12, Tobias Leich wrote: > >> In case we would know that certain methods had no side effects (and are >> not called because of their side effects), ... >> >> But at the moment we

Re: Could method calls warn in void context?

2015-01-10 Thread Moritz Lenz
To elaborate a bit on the previous answer: On 10.01.2015 17:12, Tobias Leich wrote: In case we would know that certain methods had no side effects (and are not called because of their side effects), ... But at the moment we don't know and therefore we can't warn for every method. there are tw

Re: Could method calls warn in void context?

2015-01-10 Thread Tobias Leich
In case we would know that certain methods had no side effects (and are not called because of their side effects), ... But at the moment we don't know and therefore we can't warn for every method. Am 10.01.2015 um 15:50 schrieb Gabor Szabo: > I keep writing code like this: > > $str.substr(/regex/

Could method calls warn in void context?

2015-01-10 Thread Gabor Szabo
I keep writing code like this: $str.substr(/regex/, 'replaement) when I should write $str.=substr(/regex/, 'replaement) The former will *return* the replaced string to the void but not change it. I don't know if the above can be ever useful, but maybe this kind of constructs should warn. Or m