Skip to content

Modf created data is not reliably the shallowest copy #7

@smithzvk

Description

@smithzvk

This is exemplified by PR #5. In that PR, we defined a modf on getf on a plist to include a copy of the entire list. If in one context I intended to treat the data structure as a plist, it would work to simply copy the list, which would copy all of the cons cells in the list. However, if in another context I wished to treat this plist like structure as a generalized list which ends with a user specified object that might happen to be a cons cell, all of a sudden I am now copying some user defined data which you might expect to remain uncopied.

All in all, this comes down to an implementation detail if you are actually doing true functional programming, but I think a reasonable use case is that someone might want to have a few mutable objects floating around their program for performance reasons. This nuance introduces a potential that you might have some surprising behavior.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions