3 ms·
I think the problem is that strings are ambiguous enough a collection to warrant extra semantics. The alternative to a collection would be an iterator or other
by beaconstudios 6y ago
I think the problem is that strings are ambiguous enough a collection to warrant extra semantics.
The alternative to a collection would be an iterator or other public method returning a collection-like accessor, which would be a good compromise.
Though if you were to choose a canonical collection quanta, the it'd probably be the grapheme cluster, yeah.
Unfortunately OOP can never be based; only functional or procedural programming can attain such standards.
- samatman 6y agoOOP using a meta-object protocol is very based indeed. Unfortunately, only Common Lisp and Lua do it that way. Actor models are pretty based as well, and have a better historical claim to the title "object oriented programming" than class ontologies do, but that ship has sailed.
- beaconstudios 6y agoYes agreed; I'm guessing by meta object that is the module pattern from fp with syntax sugar? I use the module pattern with typescript interfaces plus namespaces and it's pretty great. 100% on the actor model. My visual programming platform is basically based on actors, but the core data model is cybernetic (persistence is done via self referentiality). Alan Kay got shafted by the creation of C++, OO in the original conception was very based.
- saagarjha 6y agoStrings were done well, because they are just BudirectionalCollection and not RandomAccessCollection on graphemes, which is usually what you would want (especially as an app developer writing user-facing code). The other views are collections in their own right. By conforming to Collection a string can do things like be sliced and prefixed and searched over “for free”, which are extremely common operations to define generically.