Re: [julia-users] How come (x, y) isn't legal syntax?

2014-09-10 Thread Jeff Waller
I would add that ()(1,2) works; I'm imagining that it changes the context 
and forces the parser to use the one legal interpretation.


Re: [julia-users] How come (x, y) isn't legal syntax?

2014-09-09 Thread gentlebeldin
Not true,  is an undocumented singular case (regrettably). - is a unary 
operator, too, but nonetheless, -(1,5) gives -4, as it well should.

Am Dienstag, 9. September 2014 00:41:01 UTC+2 schrieb Jake Bolewski:

 Anyt unary operator defined as a `syntatic_unary_operator` 
 https://github.com/jakebolewski/JuliaParser.jl/blob/master/src/lexer.jl#L103 
 is special cased by the parser and works similarly. 

 On Monday, September 8, 2014 4:31:48 PM UTC-4, Stefan Karpinski wrote:

 I believe it is because of the use of  in ccall as a pseudo-operator to 
 pass the address of a scalar. Jeff will have to confirm or deny this though.


 On Mon, Sep 8, 2014 at 10:25 PM, Dan Luu dan...@gmail.com wrote:

 julia 1 | 2
 3
 julia 1  2
 0
 julia 1 + 2
 3
 julia 1 $ 2
 3
 julia |(1, 2)
 3
 julia (1, 2)
 ERROR: unsupported or misplaced expression 
 julia +(1, 2)
 3
 julia $(1, 2)
 ERROR: unsupported or misplaced expression $

 Is  used in some way julia that makes (1, 2) potentially ambiguous?

 Apologies if this is in the archives; I couldn't figure how to
 effectively search for '' or 'and'.


 Dan




Re: [julia-users] How come (x, y) isn't legal syntax?

2014-09-09 Thread Patrick O'Leary
On Tuesday, September 9, 2014 2:02:03 AM UTC-5, gentlebeldin wrote:

 Not true,  is an undocumented singular case (regrettably). - is a unary 
 operator, too, but nonetheless, -(1,5) gives -4, as it well should.


Did you look at the link Jake posted? The `-` operator is not in the class 
`syntactic_unary_operator`, but listed in `unary_ops`, which by implication 
doesn't have the special handling:

https://github.com/jakebolewski/JuliaParser.jl/blob/aa466d7a84dee73db9cec66dbe631c1e534ebcc0/src/lexer.jl#L89

The problem is that ``, `$`, and `::` are not just operators, but syntax 
(for instance, `` in `ccall()`, and `$` in expression interpolation), so 
they require special parser handling, and this can conflict with the normal 
rules for parsing unary operators.


[julia-users] How come (x, y) isn't legal syntax?

2014-09-08 Thread Dan Luu
julia 1 | 2
3
julia 1  2
0
julia 1 + 2
3
julia 1 $ 2
3
julia |(1, 2)
3
julia (1, 2)
ERROR: unsupported or misplaced expression 
julia +(1, 2)
3
julia $(1, 2)
ERROR: unsupported or misplaced expression $

Is  used in some way julia that makes (1, 2) potentially ambiguous?

Apologies if this is in the archives; I couldn't figure how to
effectively search for '' or 'and'.


Dan


Re: [julia-users] How come (x, y) isn't legal syntax?

2014-09-08 Thread Stefan Karpinski
I believe it is because of the use of  in ccall as a pseudo-operator to
pass the address of a scalar. Jeff will have to confirm or deny this though.


On Mon, Sep 8, 2014 at 10:25 PM, Dan Luu dan...@gmail.com wrote:

 julia 1 | 2
 3
 julia 1  2
 0
 julia 1 + 2
 3
 julia 1 $ 2
 3
 julia |(1, 2)
 3
 julia (1, 2)
 ERROR: unsupported or misplaced expression 
 julia +(1, 2)
 3
 julia $(1, 2)
 ERROR: unsupported or misplaced expression $

 Is  used in some way julia that makes (1, 2) potentially ambiguous?

 Apologies if this is in the archives; I couldn't figure how to
 effectively search for '' or 'and'.


 Dan



Re: [julia-users] How come (x, y) isn't legal syntax?

2014-09-08 Thread Jake Bolewski
Anyt unary operator defined as a `syntatic_unary_operator` 
https://github.com/jakebolewski/JuliaParser.jl/blob/master/src/lexer.jl#L103 
is special cased by the parser and works similarly. 

On Monday, September 8, 2014 4:31:48 PM UTC-4, Stefan Karpinski wrote:

 I believe it is because of the use of  in ccall as a pseudo-operator to 
 pass the address of a scalar. Jeff will have to confirm or deny this though.


 On Mon, Sep 8, 2014 at 10:25 PM, Dan Luu dan...@gmail.com javascript: 
 wrote:

 julia 1 | 2
 3
 julia 1  2
 0
 julia 1 + 2
 3
 julia 1 $ 2
 3
 julia |(1, 2)
 3
 julia (1, 2)
 ERROR: unsupported or misplaced expression 
 julia +(1, 2)
 3
 julia $(1, 2)
 ERROR: unsupported or misplaced expression $

 Is  used in some way julia that makes (1, 2) potentially ambiguous?

 Apologies if this is in the archives; I couldn't figure how to
 effectively search for '' or 'and'.


 Dan