3 ms·
Gah. An interesting thing to think about, but you do have to actually think. > Highly optimizing compilers aren't worth the risk. If they were buggy, sure. Bu
by lmm 12y ago
Gah. An interesting thing to think about, but you do have to actually think.
> Highly optimizing compilers aren't worth the risk.
If they were buggy, sure. But, probably through the weight of every single developer using them for absolutely everything, the bugs have been ironed out.
> Something is wrong if most programs don't run instantaneously.
Why? Do a straight-up cost/benefit analysis. How much extra would you pay for a program that ran twice as fast? If anything I'd expect people pay more for bigger programs that take longer to run, since they feel like they're doing something important.
> Design applications as small executables that communicate.
The microservices people are sort of doing this. It's a great way to turn all your problems into distributed problems. And what's not set up is any sensible way to send even basic data structures around. "pipes and sockets" send streams of bytes. In 2014, if I want to send an object, a function even - heck, if I want to send an inert struct - from one process to another, I'm basically stuck. The least-bad option is probably to write out the object definition in Thrift IDL, generate a bunch of code and then write a bunch more code to map back and forth with my actual program datatypes. It's hard to express quite how much it sucks, but many people have tried and failed to come up with something better.
> Don't write temporary files to disk, ever.
If you're building new executables for everything you're either doing something wrong, or you don't care about the space you're wasting. The right way to do these tiny tweaks is in an interactive, workbooky environment like ipython. If you like that style of programming.
> Everything is so complex that you need to isolate yourself from as many libraries and APIs as possible.
Absolutely backwards. Everything is so complex - and using libraries so easy - that you should use libraries for everything. A good library provides a simpler interface than the things it's built on top of, so you can just call e.g. encrypt(data) rather than doing thousands of lines of bit-twiddling.
- tonyonodi 12y ago> but many people have tried and failed to come up with something better Can you give any examples? I'd be interested.
- lmm 12y agoCORBA. Java RMI. EJB. To a certain extent Erlang (which may yet succeed), or the various Lisp S-expression serializations. (My view is that turing-complete code is the wrong abstraction and we need to draw an explicit distinction between serializable code and non-serializable code, but that would require a programming-language-level solution and a rewrite of approximately everything. Sooner or later I'll get around to writing a language based on this notion)
- spacecowboy_lon 12y agoSo why do HPC system developers still use the 1k /seat intel Fortran compiler then? Becase IPC/Kw is an much more important metric thesae days
- lmm 12y agoThe HPC folks work in the niches where people will pay extra for better performance; those niches do exist. But they are small niches.
- AnimalMuppet 12y ago> > Something is wrong if most programs don't run instantaneously. > Why? Do a straight-up cost/benefit analysis. How much extra would you pay for a program that ran twice as fast? If anything I'd expect people pay more for bigger programs that take longer to run, since they feel like they're doing something important. This is one of the things going on with Go. What's the cost/benefit of a sub-second compile time compared to a ten-minute compile time? Not all that much, really. But when you multiply it times multiple team members, times multiple daily compiles, times a code base that's going to live for the next 20 years, those slower compiles add up to a big waste.
- lmm 12y agoEh maybe. I don't find compile time is ever a limiting factor, but if it became one there are ways around it (e.g. incremental compile servers). And sacrificing a small amount of development time for fewer errors is almost always a good tradeoff. (What's your estimate of the cost of maintenance on the repetitive code that Go's inadequate type system makes necessary?)
- AnimalMuppet 12y agoThat's hard for me to say. Can you give me a concrete example of "the repetitive code that Go's inadequate type system makes necessary"?
- lmm 12y agoI'm starting from an assumption that keeping track of effects is necessary, and that these effects are things that aren't built into the language. E.g. database access, structured logging (like an audit trail). (You're allowed to say that you wouldn't want to carefully keep track of these things, that it doesn't matter whether a particular function accesses the database or not, but in that case rather than a repetitive code cost, I'd say you end up with a testing/safety/maintenance cost). An example is necessarily pretty abstract or complex, because it's only when you're doing these complex things that you really need to abstract over them at multiple levels. But I'll try: One of the fun things I can do in Scala is build up an "action" using for/yield syntax: for { f ← auditedFunction1() g = nonAuditedFunction(f) h ← auditedFunction2(g) } yield h I can do the same thing for database actions: for { results ← myQuery() modified = results map myTransformation saved ← modified traverse save() } yield saved And then I can have my Spray directives know how to handle a generic action, by writing a simple instance for each action. E.g. I can tell it to display the audit trail if a particular header is present: implicit def auditOnSuccessFutureMagnet[T]( inner: Auditable[T]) = new OnSuccessFutureMagnet { type Out = AuditTrail \/ T def get = header(MySpecialHeader) map { case Some("mySpecialValue") => -\/(inner.written) case None => \/-(inner.value) } And I can do a similar thing for database actions, wrapping them in a transaction at the HTTP request level - giving me the equivalent of session-creation-in-view, but tied to the actual request rather than a thread, and with safety maintained by the type system. All of this stuff is typesafe. I can only use a contextual action that I can provide an implementation for how to handle (there are a few defaults like e.g. Future), and I can only return an object "inside" the context that I've also provided how to handle (e.g. by providing a json formatter for that type). And none of this is special or built-in (other than the OnSuccessFutureMagnet interface that I'm implementing); all these things are custom classes or from different libraries. How could I do that in Go? I'd have to declare each of the different combinations (each possible DatabaseAction[A] and also each possible Auditable[A]) as separate types, right? And my framework certainly couldn't offer the generic handling of F[A] that lets me reuse the same functions for both, so I'd have to have separate copies for anything that I wanted to work with both DatabaseAction and Auditable.
- angersock 12y agoIt's hard to express quite how much it sucks, but many people have tried and failed to come up with something better. Erm, ZeroMQ? nanomsg? HTTP?
- lmm 12y ago> ZeroMQ? nanomsg? Still oriented towards streams of bytes, no? Frankly I don't trust the implementation based on some of the blog posts, but even if I did, the part of the problem they solve (exactly-once delivery) is one I prefer to solve in other ways. > HTTP? Can work, but still ultimately not structured enough; it's hard to evolve a HTTP API in a verifiably compatible way, and you usually end up having to maintain some kind of schema or IDL and explicit conversion code - at which point Thrift provides a standardized way of doing it.
- angersock 12y agoAll of those options provide message-centered data flows. You have to define the message format--JSON, BSON (lol), or even protobuff would work fine. Just because you refuse to use well-established tools doesn't mean they aren't there.
- lmm 12y agoThe serialization part - JSON, BSON or protobuf - is the part I'm complaining about. I have plenty of perfectly good ways to copy a packet of bytes from A to B. I want something that offers the safety guarantees of protobuf with a "simple case" that's as easy as e.g. Jackson. And I want something that can send functions, not just inert structs.