3 ms·
Author here: Note that this hasn't yet been updated for Cython 3, which does fix or improve some of these (but not the fundamental limitation that you're stuck
by itamarst 3y ago
Author here: Note that this hasn't yet been updated for Cython 3, which does fix or improve some of these (but not the fundamental limitation that you're stuck with C or C++).
- klyrs 3y agoPardon me, but your implementation is a strawman. Pick on this (which doesn't require Cython 3): from libcpp.vector cimport vector from libcpp.pair cimport pair cdef class PointVec: cdef vector[pair[float, float]] vec def __init__(self, points: list[tuple[float, float]]): self.vec = points def __repr__(self): result = ", ".join(f"({x}, {y})" for x, y in self.vec) return f"PointVec({result})" def __setitem__( self, index, point: tuple[float, float] ): cdef pair[float, float] *p = &self.vec.at(index) p.first = point[0] p.second = point[1] def __getitem__(self, index): return self.vec.at(index)
- IshKebab 3y agoYou can't disprove that a language is error prone by providing a 20 line example that happens to be correct.
- klyrs 3y agoNor can you prove that a language is error prone by providing a 40 line example written in an antiquated style that deliberately avoids using the safety features at one's disposal.
- IshKebab 3y agoYes you can, if you have to be very experienced or unreasonably thorough to know that all those safety features exist. Opt-in safety is clearly worse than opt-out safety.
- patrick451 3y agoThis assertions is representative of the myopic one-dimensional think of rustaceans. It only makes sense if the only thing your care about is safety.
- klyrs 3y agoOkay, get specific. What in my implementation requires extensive experience, or where was I unreasonably thorough?
- patrick451 3y agoC++ isn't what I would call a fundamental limitation.