Hacker News new | past | comments | ask | show | jobs | submit login

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++).



Pardon 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)


You can't disprove that a language is error prone by providing a 20 line example that happens to be correct.


Nor 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.


Yes 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.


Okay, get specific. What in my implementation requires extensive experience, or where was I unreasonably thorough?


This assertions is representative of the myopic one-dimensional think of rustaceans. It only makes sense if the only thing your care about is safety.


C++ isn't what I would call a fundamental limitation.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: