various people (mainly vtjnash, i guess) have repeatedly warned me off using the type system as much as i would like. despite this, i had the idea of sticking iterator parameters into the type system. my reasoning was that specialised code would be inlined for each iterator. it failed miserably (gave a 300x slowdown), but i don't understand why.
so can anyone give me a rough sketch of why the code at https://github.com/andrewcooke/IntModN.jl/blob/master/src/Range.jl is such a bad idea? here's the meat: immutable TypedRange{S,I,E} <: Ranges{Int} end # MyInt is used just to isolate this code; if I re-implement the generic # count I cause chaos, changing code deep within the implementation... function colon(start::MyInt, inc::MyInt, end_::MyInt) TypedRange{start.i, inc.i, end_.i}() end start{S,I,E}(r::TypedRange{S,I,E}) = S - I next{S,I,E}(r::TypedRange{S,I,E}, i::Int) = (i + I, i + I) done{S,I,E}(r::TypedRange{S,I,E}, i::Int) = I > 0 ? i >= E : i <= E thanks, andrew
