On 18/08/15 21:46, Yichao Yu wrote:

On Aug 18, 2015 2:54 PM, "Samuele Carcagno" <sam.carca...@gmail.com
<mailto:sam.carca...@gmail.com>> wrote:
 >
 > I understand that if I release a new version of a package "foo" and
put `julia 0.4` in `REQUIRE`, the package won't be updated in julia v0.3
installations. If, after the updated package is released, somebody tries
to install package "foo" from julia v0.3 what happens? Will they still
be able to install the older version of the package?
 >
 > I'm asking because I'd like to release an updated version of a
package to make it work with julia v0.4. The changes, however, are
incompatible with julia v0.3. I tried using @compat to work around the
issues but couldn't figure out how to fix this deprecation warning
without breaking v0.3 compatibility:
 > `uint8(x::Integer) is deprecated, use x % UInt8 instead`

@compat UInt8(x)

thanks for the suggestion but that doesn't do what I need. The problem is that I need to write 32-bit integers into a 24-bit file format. This requires some bit fiddling. In julia v0.3 this worked without deprecation warnings:

    write(fid, uint8(thisSample));
    write(fid, uint8(thisSample >> 8));
    write(fid, uint8(thisSample >> 16));

`thisSample` is a 32 bit integer. In julia v0.4 `UInt8(x)` fails when `x` is greater tha 2^8-1, instead the following works:

    write(fid, thisSample % UInt8);
    write(fid, (thisSample >> 8) % UInt8);
    write(fid, (thisSample >> 16) % UInt8);

the problem is it doesn't work in julia v0.3 `x % @compat UInt8` gives:
`ERROR: `rem` has no method matching rem(::Int32, ::Type{Uint8})`



Sam


 >
 > Cheers,
 >
 > Sam


Reply via email to