2 ms·
"If it represents authored Swift source, then the data representing it is immutable. You don't change what an author wrote without their permission and initiati
by bsaul 5y ago
"If it represents authored Swift source, then the data representing it is immutable. You don't change what an author wrote without their permission and initiation."
I'm sorry, what ?? Did i read this correctly ? Are they representing code using either mutable or immutable structures depending on whether the sourcecode has copyright or not ?
I'm really confused...
- b3morales 5y agoNo; the first sentence is the dominating one. If the data represents Swift code, then it's immutable. "Permission" here would mean presenting a UI to the user of a tool asking them if some source transformation should be performed.
- Disparallel 5y agoI think the interpretation intended there is that if you hand a representation of a file to a tool, it needs to be immutable. The representation likely is full of string refs and pointers to the actual data in memory to prevent egregious copying, and the caller of the api should not be able to modify the data structure they receive and accidentally modify the actual file unless they do so through an api intended for it. Nothing to do with copyright, more that swift-format or your lsp integration should never accidentally modify a file without user initiation.
- bsaul 5y agook thanks ! got confused with the meaning of "authored"