On 05/11/2012 11:57 PM, Jonathan M Davis wrote:
Then you do
bool fun() { return cast(bool)(foo in bar); }
It's not a big deal at all.
I didn't claim it was. Still, most issues people seem to have with D are
trivial syntactic ones.
It's just that if you expect in to return bool
rather than a pointer, you're going to be surprised at what happens when you
write a function like that rather than use it in an if condition.
But since the documentation clearly states that it returns a pointer, it
shouldn't
really surprise anyone
I was surprised when I read the relevant parts of the documentation.
- unless they failed to read either the documentation
or TDPL and go completely off of what they _think_ the code should mean without
actually reading anything which would teach them the language (which is a bad
idea anyway).
Well I fully agree with that last point (having read the entire language
documentation before the first attempt to install the compiler), but
1. that is perhaps not how the 'average programmer' works. it seems to
be the case that many programmers who fail to rtfm blame the tool.
(bringing up fuzzy terms like 'intuitive' to defend their pov)
2. 'in' is certainly a very non-descriptive name for what it does.
It is similar to eg. naming subtraction '<'.
3. why are we always discussing syntax on this NG?