News for hackers. Stuff that matters.
Re:RustgreSQL by ue_ on Monday January 09, 2017 @07:47AM (#13355938)
>there are bounds checking when you access array elements through indexes

I wish we didn't need bounds checking; the problem could be solved with dependently typed languages. Unfortunately Rust just panics when you access out of bounds, and doesn't warn you at compile time. Rust isn't really all that impressive.

Re:RustgreSQL by tupshin on Monday January 09, 2017 @09:06AM (#13356344)
By your own admission, what you are asking for would require dependent typing. I am hugely in favor of rust eventually acquiring such capability, but it would be a huge change, and there are reasons why dependent typing hasn't hit mainstream languages yet.
Re:RustgreSQL by GregBuchholz on Monday January 09, 2017 @09:17PM (#13361981)
>what you are asking for would require dependent typing.

I know nothing about Rust, but you might find Oleg Kiselyov's: "Eliminating Array Bound Checking through Non-Dependent Types" interesting.

http://okmij.org/ftp/Haskell/eliminating-array-bound-check.l...

You may also like:

http://okmij.org/ftp/Haskell/number-parameterized-types.pdf

http://okmij.org/ftp/Computation/resource-aware-prog/tfp.pdf

Re:RustgreSQL by eddyb on Tuesday January 10, 2017 @05:31AM (#13363904)
If that is what I think it is, see https://docs.rs/indexing for something similar, crafted from invariance over higher-ranked lifetimes, instead of types.

I don't think Rust can ever replicate the Haskell implementation identically (if we had HRTB over types), as type parametrism is gone (see: specialization RFC). However, lifetime parametrism serves a similar role in Rust, and lifetimes are closer to a concept of "instance" than types.

Re:RustgreSQL by solidsnack9000 on Monday January 09, 2017 @11:59AM (#13357740)
By comparison to C, though...