3 ms·
> State is necessary not "evil" but needs to be managed well. > And most OO-languages have, apart from the assignment operation, no abstractions for Yep. "On
by mpweiher 9y ago
> State is necessary not "evil" but needs to be managed well.
> And most OO-languages have, apart from the assignment operation, no abstractions for
Yep. "Once you're inside an object, it's essentially Pascal" -- David Robson
That's what Polymorphic Identifiers[1][2] in Objective-Smalltalk[3] address. Partial inspiration was the Web and its REST model, which shows that using state as the basis for composition is not just possible, but works really, really well at the largest possible scales.
What it does is replace your bog-standard programming language identifiers with URIs. So you can write things like the following:
comment := https://news.ycombinator.com/item?id=14997098
file:/tmp/comment := https://news.ycombinator.com/item?id=14997098
file:{$HOME}/comment := https://news.ycombinator.com/item?id=14997098
file:{$HOME)/comments/{id} := https://news.ycombinator.com/item?id={id}
But that's not the cool thing. The cool thing is that scheme handlers are completely user-defined and composable, so you can abstract over state handling, with scheme combinators that take other scheme handlers as parameters, for example a cache, or filters.
Oh, and references (ref:comment, ref:file:/tmp/comment, ...) generalize the concept of pointer. So creating a symbolic links becomes:
file:link := ref:file:path/to/link/target
etc.
[1] http://dl.acm.org/citation.cfm?id=2508169 http://dl.acm.org/citation.cfm?id=2508169
[2] https://www.hpi.uni-potsdam.de/hirschfeld/publications/media/WeiherHirschfeld_2013_PolymorphicIdentifiersUniformResourceAccessInObjectiveSmalltalk_AcmDL.pdf https://www.hpi.uni-potsdam.de/hirschfeld/publications/media...
[3] http://objective.st/URIs/ http://objective.st/URIs/