Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-09 Thread Tim Holy
import Base: !

also works (and you can include more operators).

--Tim

On Monday, August 8, 2016 9:59:25 PM CDT Fengyang Wang wrote:
> On Monday, August 8, 2016 at 10:26:46 AM UTC-4, Kevin Squire wrote:
> > Try
> > 
> >   import Base.(!)
> > 
> > Cheers,
> > 
> >   Kevin
> 
> Why do import statements have different syntax? This syntax, I'm pretty
> sure, has either meant getfield or broadcast—in neither case does it
> actually refer to the ! function.




Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-09 Thread Kevin Squire
Sorry, yes, I meant fused broadcast.  Or at least, I'm guessing this
behavior was caused by some combination of
https://github.com/JuliaLang/julia/pull/15032 and
https://github.com/JuliaLang/julia/pull/17300.

Cheers,
   Kevin



On Tue, Aug 9, 2016 at 12:00 AM, Bart Janssens 
wrote:

> On Tue, Aug 9, 2016 at 7:21 AM Kevin Squire 
> wrote:
>
>> Generally it's not a different syntax, and the error generated here is
>> probably a consequence of recent parser changes to handle dot-operator
>> overloading (and should probably be reported as a bug, and possibly fixed.)
>>
>
> You mean fused broadcasting syntax, right? Or is full dot-operator
> overloading on the table again?
>
> Cheers,
>
> Bart
>


Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-09 Thread Bart Janssens
On Tue, Aug 9, 2016 at 7:21 AM Kevin Squire  wrote:

> Generally it's not a different syntax, and the error generated here is
> probably a consequence of recent parser changes to handle dot-operator
> overloading (and should probably be reported as a bug, and possibly fixed.)
>

You mean fused broadcasting syntax, right? Or is full dot-operator
overloading on the table again?

Cheers,

Bart


Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-08 Thread Kevin Squire
Generally it's not a different syntax, and the error generated here is
probably a consequence of recent parser changes to handle dot-operator
overloading (and should probably be reported as a bug, and possibly fixed.)

The syntax I suggested is related (I think) to the fact that some operators
need parentheses around them in order to define functions for them:

julia> &(a) = "hi"
ERROR: syntax: invalid assignment location

julia> (&)(a) = "hi"
WARNING: module Main should explicitly import & from Base
& (generic function with 36 methods)

But I agree that it's inconsistent with parsing elsewhere. It would
probably be best to deprecate `import Base.xxx` in favor of `import Base:
xxx` (i.e., removing `import Base.(!)`)

(An early conversation about operator functions needing parentheses is here
.)

Cheers,
   Kevin

On Mon, Aug 8, 2016 at 9:59 PM, Fengyang Wang 
wrote:

> On Monday, August 8, 2016 at 10:26:46 AM UTC-4, Kevin Squire wrote:
>>
>> Try
>>
>>   import Base.(!)
>>
>> Cheers,
>>   Kevin
>>
>
> Why do import statements have different syntax? This syntax, I'm pretty
> sure, has either meant getfield or broadcast—in neither case does it
> actually refer to the ! function.
>


Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-08 Thread Fengyang Wang
On Monday, August 8, 2016 at 10:26:46 AM UTC-4, Kevin Squire wrote:
>
> Try
>
>   import Base.(!)
>
> Cheers,
>   Kevin 
>

Why do import statements have different syntax? This syntax, I'm pretty 
sure, has either meant getfield or broadcast—in neither case does it 
actually refer to the ! function.


Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-08 Thread Scott T
I checked Compat, but it doesn't work with import or using:

julia> @compat import Base.:!
ERROR: syntax: invalid "import" statement: expected identifier

julia> import @compat Base.:!
ERROR: ArgumentError: @compat not found in path.
Run Pkg.add("@compat") to install the @compat package
 in require(::Symbol) at ./loading.jl:346

On Monday, 8 August 2016 16:56:34 UTC+1, Jacob Quinn wrote:
>
> There's also a Compat.jl entry for this, see the first bullet point in the 
> documentation on the README. That way, you can just do 
>
> @compat Base.:!
>
> and it will be valid for both 0.4/0.5.
>
> https://github.com/JuliaLang/Compat.jl
>
> -Jacob
>
>
> On Mon, Aug 8, 2016 at 9:04 AM, Scott T  > wrote:
>
>> Great, thanks. I found that 
>> import Base: !
>> also works and is also compatible with 0.4/0.5. 
>>
>> On Monday, 8 August 2016 15:26:46 UTC+1, Kevin Squire wrote:
>>>
>>> Try
>>>
>>>   import Base.(!)
>>>
>>> Cheers,
>>>   Kevin 
>>>
>>> On Monday, August 8, 2016, Scott T  wrote:
>>>
 In 0.4 I would write: import Base.!
 The syntax Base.:! is not yet supported.

 In 0.5:

 julia> import Base.:!
 ERROR: syntax: invalid "import" statement: expected identifier

 julia> import Base.!
 ERROR: syntax: invalid operator ".!"

 What am I missing here?

>>>
>

Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-08 Thread Jacob Quinn
There's also a Compat.jl entry for this, see the first bullet point in the
documentation on the README. That way, you can just do

@compat Base.:!

and it will be valid for both 0.4/0.5.

https://github.com/JuliaLang/Compat.jl

-Jacob


On Mon, Aug 8, 2016 at 9:04 AM, Scott T  wrote:

> Great, thanks. I found that
> import Base: !
> also works and is also compatible with 0.4/0.5.
>
> On Monday, 8 August 2016 15:26:46 UTC+1, Kevin Squire wrote:
>>
>> Try
>>
>>   import Base.(!)
>>
>> Cheers,
>>   Kevin
>>
>> On Monday, August 8, 2016, Scott T  wrote:
>>
>>> In 0.4 I would write: import Base.!
>>> The syntax Base.:! is not yet supported.
>>>
>>> In 0.5:
>>>
>>> julia> import Base.:!
>>> ERROR: syntax: invalid "import" statement: expected identifier
>>>
>>> julia> import Base.!
>>> ERROR: syntax: invalid operator ".!"
>>>
>>> What am I missing here?
>>>
>>


Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-08 Thread Scott T
Great, thanks. I found that 
import Base: !
also works and is also compatible with 0.4/0.5. 

On Monday, 8 August 2016 15:26:46 UTC+1, Kevin Squire wrote:
>
> Try
>
>   import Base.(!)
>
> Cheers,
>   Kevin 
>
> On Monday, August 8, 2016, Scott T  
> wrote:
>
>> In 0.4 I would write: import Base.!
>> The syntax Base.:! is not yet supported.
>>
>> In 0.5:
>>
>> julia> import Base.:!
>> ERROR: syntax: invalid "import" statement: expected identifier
>>
>> julia> import Base.!
>> ERROR: syntax: invalid operator ".!"
>>
>> What am I missing here?
>>
>

Re: [julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-08 Thread Kevin Squire
Try

  import Base.(!)

Cheers,
  Kevin

On Monday, August 8, 2016, Scott T  wrote:

> In 0.4 I would write: import Base.!
> The syntax Base.:! is not yet supported.
>
> In 0.5:
>
> julia> import Base.:!
> ERROR: syntax: invalid "import" statement: expected identifier
>
> julia> import Base.!
> ERROR: syntax: invalid operator ".!"
>
> What am I missing here?
>


[julia-users] How do I write `import Base.!` in julia 0.5?

2016-08-08 Thread Scott T
In 0.4 I would write: import Base.!
The syntax Base.:! is not yet supported.

In 0.5:

julia> import Base.:!
ERROR: syntax: invalid "import" statement: expected identifier

julia> import Base.!
ERROR: syntax: invalid operator ".!"

What am I missing here?