-
Notifications
You must be signed in to change notification settings - Fork 152
Length inferred a[3:end]? #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A possible solution was discussed in #703 . For now I would probably just convert |
Ah good point. |
I agree this would be nice. In #703 we thought ranges which are conceptually derived from So |
That would work - but it's still not perfect in the case tht the |
Yep that's what I meant with the obscure comment about contagiousness and type stability :)
This is kinda bad in the same way that using
|
I'm not a compiler designer but it would be convenient if all functions behaved like What about supporting |
Well this does break referential transparency everywhere that literals appear. This is also why |
I would argue that literal constants could have been implemented as a special type, essentially how Anyways at this point it's too late and that's a bit of an off topic discussion... |
I guess assignment already breaks referential transparency by introducing sequence points... so in a sense that's the place to degrade "literal types" into normal numbers. But yeah, probably pure speculation at this point :) Having for i=1:length(a)
b[i] = foo(a[i:end])
end but maybe that's ok? |
I'm wishing to do things like
a[3:end]
but have it return anSVector
. I found a way to do this:Is there an establish idiom for this? Would it be worth adding this to the package say as a special type (
a[SToEnd(3)]
)?The text was updated successfully, but these errors were encountered: