That would defeat the purpose. Compat needs to be as recent as the new syntax 
and features that it abstracts over.


> On Oct 11, 2014, at 5:27 PM, Tony Fong <[email protected]> wrote:
> 
> Great! Shouldn't it be in Base?
> 
>> On Sunday, October 12, 2014 1:17:38 AM UTC+7, Stefan Karpinski wrote:
>> This announcement is primarily for Julia package developers. Since there is 
>> already some syntax breakage between Julia v0.3 and v0.4, and there will be 
>> more, it's increasingly tricky to make packages to work on both versions. 
>> The Compat package was just created to help: it provides compatibility 
>> constructs that will work in both versions without warnings.
>> 
>> For example, in v0.3 you could create a dictionary like this:
>> 
>> julia> [ :foo => 1, :bar => 2 ]
>> Dict{Symbol,Int64} with 2 entries:
>>   :bar => 2
>>   :foo => 1
>> 
>> This still works in v0.4 but it produces a warning. The new syntax is this:
>> 
>> julia> Dict(:foo => 1, :bar => 2)
>> Dict{Symbol,Int64} with 2 entries:
>>   :bar => 2
>>   :foo => 1
>> 
>> However, this newer syntax won't work in v0.3, so you're a bit stuck if you 
>> want to write a dictionary literal in a way that will work in both v0.3 and 
>> v0.4 without producing a warning. Compat to the rescue!:
>> 
>> julia> using Compat
>> 
>> julia> @Compat.Dict(:foo => 2, :bar => 2)
>> Dict{Symbol,Int64} with 2 entries:
>>   :bar => 2
>>   :foo => 2
>> 
>> This works with no warning on both v0.3 and v0.4. We've intentionally not 
>> exported the Dict macro so that the usage needs to be prefixed with 
>> "Compat.", which will make usages of the compatibility workarounds easier to 
>> find and remove later when they're no longer necessary.
>> 
>> Currently, there's only a couple of definitions in the Compat package, but 
>> if you have your own hacks that have helped make it easier to write 
>> cross-version package code, please contribute them and we can build up a 
>> nice little collection.

Reply via email to