54 karma · joined August 20, 2017
I don't care about getting it myself. Although, it should be pointed out, you don't have to 'negotiate' for health care or notify someone of your preexisting conditions or any of that crap. You just have to turn up and you'll be treated entirely for free.
But I also want to live in a country where this applies to everyone that doesn't earn as much as me too.
The unsafe block is there because it does FFI, which hasn't actually been verified to be safe.
It's been a couple of years since I last voted in NZ (election in 3 weeks, and it's every 3 years) but I definitely don't think you're allowed to put any identifying mark on your ballot here..
Was that interpreted as a complaint as well? Is that the problem?
So basically it's designed for cases like 'I have N goroutines and each one owns 1/N keys'?
No it was not. Not per-capita. Growth ignoring population changes is literally completely irrelevant. It has never been relevant.
>It seems like NZ is growing at a pace of around 3%p.a. You're free to argue that there's some fantastic economic system that only you know, but most people will rightfully be sceptical of such claims unless you have a few examples of countries at NZ's high level of development growing at a much higher pace.
NZ before the horrific and inhumane neoliberal reforms of the 1980s ruined this beautiful country was growing at a much faster rate that it has ever grown since.
>Other than that I've lost track of what were arguing. It appears as if you just start making completely unrelated arguments when you're proven wrong.
Lol
The reason that functions have type signatures is that you can read them. You can tell which functions can cause SomeError by going and reading their definitions.
>I prefer explicit over implicit since I find it far more readable.
'Explicit over implicit' is dogma. Rust requires you to annotate your code with gibberish in cases where it is not necessary.
>You can quibble about the names (Option and map), but Option is essentially the Maybe monad and map is bind, so you're kinda arguing against core functional programing constructs.
That's literally my entire point. The attitude that it's technically a Functor so it makes sense for it to be called map? No, it doesn't. It's not a map. You're not mapping over anything. Naming is important.
Calling it 'the Maybe monad' shows that you actually have no idea what you are talking about. It's not 'the Maybe monad'. The Maybe monad is the instance of Monad for Maybe. It is not Maybe itself.
The entire concept of having the literal 'Monad' word as a word in your language, a thing that you use in programming, is very stupid. Monad is not a useful or good abstraction. Maybe is a good abstraction. Or Optional, or Option, or whatever you decide to call it. But Monad is a bad abstraction. Abstracting over superficial syntactic similarities between completely different constructs is completely stupid.
The name being terrible is not 'quibbling' by the way. Naming is incredibly important. Calling it 'map' just shows how out of touch Rust is with real programmers.
And of course I'm using RAII to roll back the transaction. When the object is destroyed the vector is destroyed and the transaction isn't run.
It doesn't make any sense at all, quite frankly, to use RAII to do what you wrote there. That's not what RAII is for, nor is it what RAII is good at. RAII is for managing resources.
What was disgusting about saying 'hey maybe the reason that women aren't in software is that they don't want to be in software and there's nothing wrong with that as long as the women that are in software are treated well'?
99.9% of code review that I do, and that I get, is not training. So maybe don't make all the changes for new employees? I use vim. Most people at my work use vim. Our build process is complex. Everything we do is really complicated. It works for the experienced, yet it has a learning curve.
So, new people get a slightly different experience. That's fine.
That would, presumably, be women in software? Because as far as I can tell, the only people being regularly harassed on Twitter are people that don't think women should get special rights...
Did you actually read the memo? If he's a nazi, then so is 95% of the world's population.
Yes. Yes yes yes. I hate this so much. I want my code reviews to involve fixing little things. I don't even have suggested edits, I can only highlight comments and make comments, and even suggested edits wouldn't be enough. I want to just make the changes. It's all on a branch anyway.
There's no reason we shouldn't be growing much more quickly. But we're not going to do so in a neoliberal world. That's just not going to happen. Draining the wealth of society to a small group of people that spend little money just doesn't drive growth.
People can't spend and drive the economy when they're dirt poor.
If you have an object representing some sort of transaction, and you just have actually-do-all-the-work-at-once-on-commit-being-called semantics, you don't actually need to do anything in your destructor at all, right?
template<typename T>
class transaction {
std::vector<T> things_to_do;
public:
void add_work_item(T t) {
things_to_do.push_back(t);
}
void commit() {
for (auto t : things_to_do) {
t.do();
}
}
}; import socket
import threading
import socketserver
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
data = str(self.request.recv(1024), 'ascii')
cur_thread = threading.current_thread()
response = bytes("{}: {}".format(cur_thread.name, data), 'ascii')
self.request.sendall(response)
class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass
def client(ip, port, message):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.connect((ip, port))
sock.sendall(bytes(message, 'ascii'))
response = str(sock.recv(1024), 'ascii')
print("Received: {}".format(response))
if __name__ == "__main__":
# Port 0 means to select an arbitrary unused port
HOST, PORT = "localhost", 0
server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)
with server:
ip, port = server.server_address
# Start a thread with the server -- that thread will then start one
# more thread for each request
server_thread = threading.Thread(target=server.serve_forever)
# Exit the server thread when the main thread terminates
server_thread.daemon = True
server_thread.start()
print("Server loop running in thread:", server_thread.name)
client(ip, port, "Hello World 1")
client(ip, port, "Hello World 2")
client(ip, port, "Hello World 3")
server.shutdown()
Why not this: def handle(request):
data = str(request.recv(1024), 'ascii')
cur_thread = threading.current_thread()
response = bytes("{}: {}".format(cur_thread.name, data), 'ascii')
request.sendall(response)
and this: options = socketserver.ServerOptions(
concurrency=socketserver.Threading,
sockets=socketserver.TcpSockets)
server = socketserver.Server((HOST, PORT), options)
There's really not any use of inheritance here anyway: it's just a hack. It's such a hack that you need to inherit those two classes (ThreadingMixin and TCPServer) in that order, because one overrides a method of the other, and if you inherit them in the other order it just doesn't work.It might simplify the implementation, I don't know, but it definitely doesn't simplify the interface.
The 'state of the art' is increasing, over-the-top complexity to a truly ridiculous level. Go programmers don't want to open up the documentation for a library and see this:
http://i.imgur.com/ALlbPRa.png
or look at the language reference and see this:
http://en.cppreference.com/w/cpp/language/constraints
and I don't blame them.
Except instead of just writing `throws SomeError` in the declaration line of the function, you have to annotate virtually every line of your function with `?` and wrap the return line in `Ok(...)`.
Writing this sort of thing in Rust:
fun some_function(a: &A) -> Result<&B, SomeError> {
let c = foo(a)?;
let d = foobar(a, c)?;
Ok(if xfoo(c) {
let e = blah()?;
bar(d, e)?
} else {
baz(d)?
})
}
where you have to write every function in this pseudo-do-notation where 'return' is just wrapping the return expression in 'Ok' and `a <- expr` becomes `let a = expr?;` is just horrible.I'd much rather write this:
fun some_function(a: &A) -> &B throws SomeError {
let c = foo(a);
let d = foobar(a, c);
if xfoo(c) {
let e = blah();
bar(d, e)
} else {
baz(d)
}
}
See how that's so much cleaner? It's not actually any different from exceptions anyway, you're basically using them like exceptions, and they're implemented in the same way. The difference is that in the latter the code is much simpler and easier to understand. That's all.In fact, that syntax could be added to Rust (after 6-12 months of bikeshedding as usual) and just have it automatically translated to the above anyway.
The other issue with Result/Option is that people start doing really horrible things like adding Option::map. Sorry but it's not a container that has 0 or 1 things in it. It's an optional value. That they're mathematically equivalent doesn't mean that they're the same thing conceptually. It's as bad as pretending that Result<T, Err> is useless and everyone only needs Either<L, R> where by convention R is the error value. God please just no.
The New Zealand government really wants people to believe that we're experiencing 'economic growth'. But while they might be technically right, they're effectively wrong. Economic growth that is so much entirely from immigration that we're effectively in per-capita-GDP recession is not real, useful, good growth.