logoalt Hacker News

otabdeveloper4today at 12:20 PM2 repliesview on HN

Yeah, C++ arrays are literally that.


Replies

alpinismetoday at 12:46 PM

Arrays are not dynamically sized though (handling runtime sizes) and don’t have efficient append/concat. The point of the dependent types is that you can have the type system track that concat creates an M+N length vector, sort preserves length (and adds a sorted guarantee that slice preserves), etc. Sure you can do a lot with templates, but that’s advanced templates not just “C++ arrays” in a throwaway “literally that” way.