i think this one deserves a "finally". we're thinking about fixed-size arrays in swift https://forums.swift.org/t/vector-a-fixed-size-array/75264
-
i think this one deserves a "finally". we're thinking about fixed-size arrays in swift https://forums.swift.org/t/vector-a-fixed-size-array/75264
-
@joe correct me if I’m wrong, but isn’t “Vector” commonly understood to be analogous with “dynamic-sized array” in almost all popular systems programming languages? Why call this type Vector?
-
@markmalstrom @joe the unfortunate fact that C++ got it wrong and Rust followed does not require Swift get it wrong too.
That said, I’m sure this will be discussed at some length in the pitch thread.
-
@steve “wrong” by what metric?
-
@markmalstrom Stepanov: “Unfortunately, this was inconsistent with the much older meaning of the term in mathematics and violates Rule 3; this data structure should have been called array. Sadly, if you make a mistake and violate these principles, the result might stay around for a long time.”
-
@markmalstrom Stroustrup: “One could argue that valarray should have been called vector because it is a traditional mathematical vector and that vector should have been called array.”
-
@steve so, while I understand and sympathize with this, I do think for practicality’s sake, it makes more sense to be explicit about it and call the data structure something like FixedSizeArray. But it’s not something I feel strongly enough about to do anything beyond posting this message 🤪
Especially since I already fought one losing battle on naming in Swift with Double. There’s no `Long`! But I digress…
-
@markmalstrom It's really interesting to me that a bunch of people have this initial reaction to "vector", but (AFAIK) no one batted an eye at "array", which is backwards from C++ in exactly the same way.
-
@steve @markmalstrom A bunch of people did complain about Array. We decided NSArray was the most important thing to match—if it was wrong, it was wrong since the 80s.
(I’m still thinking about Vector.)
-
@jrose @markmalstrom (which makes it even funnier because NSArray is yet another, different thing.)
-
@steve @jrose @markmalstrom
“List” just sulking over in the corner -
Harshil Shah :psyduck:replied to Paul Cantrell last edited by
@inthehands @steve @jrose @markmalstrom SwiftUI says hello
-
Paul Cantrellreplied to Harshil Shah :psyduck: last edited by [email protected]
@harshil @steve @jrose @markmalstrom And it has stacks too! and Map! Now SwiftUI just needs views named Queue and Hashtable.
-
Jonathan Wightreplied to Paul Cantrell last edited by
@inthehands @harshil @steve @jrose @markmalstrom it has table and grid. You weren’t even trying.
-
Paul Cantrellreplied to Jonathan Wight last edited by
@schwa (thinking specifically of UI components that are commonly ADTs in other langs)