6 ms·
Don't immutable data structures give us most of the benefits? Clojure, for example, approaches this by preferring values over hidden, mutable state (e.g. classe
by elbenshira 12y ago
Don't immutable data structures give us most of the benefits? Clojure, for example, approaches this by preferring values over hidden, mutable state (e.g. classes). We see libraries like Om take advantage of the fact that comparing two complex structures (e.g. a hash map) is simply a reference equality test.
http://clojure.org/state http://clojure.org/state
http://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/ http://swannodette.github.io/2013/12/17/the-future-of-javasc...
- dllthomas 12y agoImmutable data structures give us many benefits, but linear types promise most of those plus safe mutability. Think of it as a compile-time proof that you'll be getting vector fusion style speed-ups.
- deleted 12y ago[deleted]
- tel 12y agoNot at all. Linear types ensure that types are "used" exactly once. Mutability would correspond to type creation while reading would be a use. For a fun little example of thinking in linear types, take a look at Brent Yorgey's blog post: http://byorgey.wordpress.com/2011/02/24/enumerating-linear-inhabitants/ http://byorgey.wordpress.com/2011/02/24/enumerating-linear-i... (Edit: The Yorgey post listed links to the whole cycle, but it begins here: http://byorgey.wordpress.com/2011/01/26/counting-linear-lambda-terms/ http://byorgey.wordpress.com/2011/01/26/counting-linear-lamb...)
- gohrt 12y agoClojure transients are linear types.
- dj-wonk 12y agoHow? Please refute this claim: "Transients have very little, if anything, to do with types." Why would I claim this? Transients are about the internal nature of a function but have nothing to do with the return value or type. See "Transient data structures are a solution to this optimization problem that integrates with the Clojure model and provides the same thread safety guarantees you expect of Clojure." at http://clojure.org/transients http://clojure.org/transients
- gohrt 12y agoTransients are a different type from the corresponding persistent, as seen by the fact that different operations are supported. Clojure's programmer-facing type system doesn't expose the transient type explicitly, but the semantics certainly implements a linear type system. From the page you linked: """ Capture return value, use for next call Not persistent, so you can't hang onto interim values or alias """ From Rich Hickey himself: http://www.infoq.com/interviews/hickey-clojure-protocols http://www.infoq.com/interviews/hickey-clojure-protocols More context: http://c2.com/cgi/wiki?LinearTypes http://c2.com/cgi/wiki?LinearTypes