Locke Cole wrote:
It's not just literal spaces, but *any* whitespace (carriage returns, tabs, etc). So you could do, for example:
{{#if :<string> |<then result> |<else result> }}
Any number of strange examples could be proposed, but I'd expect that parsing the token is easier with the colon attached. I'll leave that to the expert implementors. I just want to put my oar in saying it's really a waste of effort.
Oh, and I'd just write that as (I hate it when folks move the test away from the conditional): {{#if: <string> | <then result> | <else result> }}
Note also that the result strings are also trimmed of whitespace, so the CR/LF are ignored.
Yeah, saw that in the code.
So, it should be called "#ifdef:" to match ingrained expectations. Could "#if:" be quickly retired?
#if is shorter which is probably why it'll be kept as-is.
Here's where I jump up and down and holler!
Short is *NOT* an important desired design constraint!
Speaking as somebody with a fair amount design, documentation, implementation, and operational experience (you all use my work every day), it's really important to keep things as consistent as possible. Remember the principle of least surprise!
Folks are likely to do things based on prior experience. Folks writing templates are even more likely than the general editors to have programming language experience.
Consistency may be the hobgoblin of little minds, but there are a lot of small minds to worry about -- it's not foolish!
The semantics of "#if:" no longer match the semantics of PHP if.
The semantics also do not match the semantics of CPP #if, but the visual representation will bring that to programmers' minds.
This is closer to CPP #ifdef. If not changed to "#ifdef", I foresee eons of queries and errors.
Now is the time to rectify the situation. There are only a few instances, and it should be easy to add #ifdef: and remove #if: a few days later. With the holiday activities, there should be less going on right now, so this is an excellent time to work on such changes in the background with less stress on the servers.
I proposed it on the talk page a little while ago (which is where most discussion is going on right now).
I tried to join meta some time ago, but it wouldn't let me login or create my name. I checked the logs, and there are no others with my name. There is/was some form of restriction of participants? I'm hoping that single sign-on will handle everything soon.