673 karma · joined Jun 27, 2013 (13y ago) · 322 submissions
comment 9y ago · link · parent
Learning to deal with stuff yourself doesn't preclude asking your partner for help with making a decision that can impact both of you for the rest of your lives.
comment 9y ago · link · parent
In practice I don't know if anyone is overly concerned about this. While Rust doesn't have linear types, I find you have to bend over backwards to introduce a situation where you might accidentally leak a resource.
Tarean makes a good point with respect to fusion, but "guaranteeing" fusion requires additional assistance from the compiler in addition to the basic implementation of linear types.
comment 9y ago · link · parent
In a purely functional language with affine types, unused variables are usually just optimized out.
comment 9y ago · link · parent
open : () -> File
close : File -> ()
write : (File, String) -> File
let f: File = open()
let new_f : File = write(f, "Hello world!\n")
close(new_f)
If this seems clumsy or error-prone, notice that you can't accidentally close() f instead of new_f, and you can't forget to close() new_f, so there is actually very little room for error here.comment 9y ago · link · parent
As an example, compare two languages: one with linear types and one with affine types. Let's say that you had a "File" type, a function "open()" that creates a file (either linear or affine as appropriate), and a function "close()" that consumes the file. Then this code would be legal in both languages with linear types and languages with affine types:
let f: File = open()
close(f)
Note that "f" is used once and only once, at which point the value is consumed. In a language with affine types, this is also kosher: let f: File = open()
// Do nothing
This fails to compile in the language with linear types because "f" is never used. Finally, this code is never legal in either language: let f: File = open()
close(f)
close(f)
... because "f" is used twice here, and neither linear types nor affine types allow that.So affine types give you a little more leeway.
comment 9y ago · link · parent
Ugh, no. There are references all over the place when I write Rust code -- it would be a serious bummer for me if annotating those types and making those references took up 4 characters for "ref " instead of just the 1 for &.
comment 9y ago · link · parent
comment 9y ago · link · parent
> An algorithm that takes infinite time for 1 instruction is O(1) and still constant time.
> An algorithm that takes infinite memory for every run is still a constant memory complexity.
None of these are true.
comment 9y ago · link · parent
D has optional GC but their standard library is kind of fucked up.
comment 9y ago · link · parent
> What puzzles me about the discussions around “fake news”, is how everybody in favor of free speech is now calling for censorship. Like, really? Don’t you see where this will lead — ”a Ministry of Truth” and other things that only 1984 could have envisioned.
There is no one prominent who is arguing for unilateral government censorship of fake news sites. What has been proposed are a series of reforms, usually outside of the legal system, to help people identify blatantly incorrect but otherwise convincing-looking articles on big platforms like Facebook, which bears no resemblance to anything Orwellian.
comment 9y ago · link · parent
For the record I'm not an RMS-ite and I don't actually mean to compare proprietary software with slavery.