Re: [julia-users] Overriding type promotion

2014-04-04 Thread Carlos Becker
Thanks Tim, that makes total sense, though I was thinking of a way of expressing this in a matlab-ish kind of way. How about defining a macro to override type promotion, similar to @inbounds? @nopromote b = A / uint8(2) I would like something shorter, but we could decide on the exact name

Re: [julia-users] Overriding type promotion

2014-04-04 Thread Mikael Simberg
It seems like div might do exactly what you want, although I'm not sure what it does behind the scenes. julia A = rand(Uint8, (100, 100)); julia b = div(A, uint8(2)) 100x100 Array{Uint8,2}: ... Also, it seems like it keeps the type of the numerator, no matter the (integer) type of the

Re: [julia-users] Overriding type promotion

2014-04-04 Thread Carlos Becker
I don't see that as a viable option either. I am trying to find out which other operations would do such promotion, but so far the relevant one seems to be only division, I can handle that. Now, in terms of hypothetical workarounds, what about having a macro to override type promotion? Would that