One important difference is the precedence of these two operators. For example in AssemblyScript which you may consider like a stricter TypeScript, you may more often feel the need to decide on using one or the other.
const COPY_FROM : usize = <u64>start >>> 6 as usize;
start
which is a number type casted into unsigned 64 bit integer, right shifted by 6 bits and the result is casted to <usize>
pointer type. Which is exactly the desired behaviour.
However
const COPY_FROM : usize = <u64>start >>> <usize>6;
is not what we want and wouldn't even compile. Yet,
const COPY_FROM : usize = <usize>(<u64>start >>> 6);
is harder to read and not so pretty.
However as I understand for some unknown reason the precedence of as
is not low enough to be a trailing operator. For example had the above code be like;
const COPY_FROM : usize = <u64>start & 63 as usize; // start % 64
then it would either throw or yield wrong result as seemingly the precidence of as
is higher than the &
operator. So we best be careful using it.