And in any other context in Julia, "in" is a function that returns "true" 
or "false" based on whether the first thing is in the second thing.

As far as I'm aware, the language is supposed to be structured to make it 
easy for a human to understand, with the underlying parser then converting 
it into a form that a computer understands. The parsing is the underlying 
interpretation; why should we impose the parser's interpretation? "for 
i=1:n" reads naturally as "for i equals 1 through n", even as "1:n" reads 
as "1 through n". On the other hand, "for i in 1:n" would be read as "for i 
in 1 through n", which makes no sense. Of course, if you get more wordy, it 
can be redeemed - "for i in the range 1 through n"... but I can't imagine 
anybody would read "1:n" as the phrase "the range 1 through n".



On Thursday, 29 October 2015 03:05:05 UTC+10, mschauer wrote:
>
>
> Let's shortly state why "in" is more appropriate. The notion "for i = 1 : 
> n" is established and meaningful *when* read as "for (i = 1) : (n)", very 
> similar in the mathematical notation $\sum_{i=1}^{n} f(i)$. Notice the 
> parentheses in both expressions! On the other hand, at any other location 
> "r = 1:2" in julia parses as "r = (1:2)" and indicates that r is a range 
> and not that r is an integer from a range. 
>
>
>
>
> Am Mittwoch, 28. Oktober 2015 15:16:37 UTC+1 schrieb Stefan Karpinski:
>>
>> No, it's just a matter of changing the parser to accept that – and 
>> convincing people that it's a good idea.
>>
>> On Wed, Oct 28, 2015 at 9:39 AM, DNF <[email protected]> wrote:
>>
>>> On Wednesday, October 28, 2015 at 2:29:54 PM UTC+1, Stefan Karpinski 
>>> wrote:
>>>>
>>>> I think we're getting into Parkinson's law territory here. First off, I 
>>>> don't think this causes all that much confusion. Second, since this is 
>>>> pure 
>>>> syntax involving a keyword no less, this is one of the easiest things to 
>>>> mechanically fix should we chose to do so in the future.
>>>>
>>>
>>> Fair enough. Could I just ask a question out of curiosity (not to try to 
>>> convince anyone of anything)?
>>>
>>> Are there any technical problems (or other problems) associated with 
>>> getting '∈' to work as a keyword, such as 
>>> for i ∈ etc...
>>> ?
>>>
>>
>>

Reply via email to