6 ms·
I can't answer the question directly, because as a web engineer I haven't once in my career actually had to do linear algebra in my code. That said, the entire
by nbouscal 11y ago
I can't answer the question directly, because as a web engineer I haven't once in my career actually had to do linear algebra in my code. That said, the entire mindset behind this article strikes me as fundamentally wrong-headed. The mindset is “either you have static types, or you don't.” From that perspective, if you can think of any situation in which you can't encode the problem into static types, then you might as well throw the whole idea out the window and just hope things work at run-time. In the real world, this isn't at all how it works.
The last couple of decades have been a story of type systems slowly but surely expanding the class of problems for which type-safety is practical and worthwhile. There are still problems for which this isn't the case, and there will likely still be problems like this for a long time. Proponents of static typing aren't arguing against this fact; they're arguing that for all the myriad cases where static types can help, we should use them. For the cases we can't figure out, fine, just use ints. But for those functions, write a lot of tests, and be sure to rewrap those ints in semantic types as soon as possible.
In short, whether or not my static type system can handle linear algebra is completely irrelevant to me. To be worth using, my type system doesn't have to solve every problem. It only has to solve enough problems to provide more benefit than cost. In my experience, it does that by multiple orders of magnitude.
- moron4hire 11y ago>>I can't answer the question directly, because as a web engineer I haven't once in my career actually had to do linear algebra in my code. Wow, really? I am a web developer and I have to do tons of math. Not just the WebGL/VR stuff, but the CRUD stuff too. Reports and queries and, yes, unit translations. Like, what do you do? What are you making that doesn't need math? I've never not needed math. I wish I knew MORE math.
- Terr_ 11y agoHe did not say "math", he said "linear algebra", which is much more specific and specialized. When was the last time your "CRUD stuff" involved solving a set of linear equations?
- moron4hire 11y agoNo, no, I think it's one of the most generally useful fields of applied math. You need it for best-fit functions, at the very least.
- ajkjk 11y agoIt's incredibly rare to not use a library for this kind of math unless you actually work on mathematical software.
- moron4hire 11y agoLook, the person I was replying to clearly meant to express "web engineer, therefore not mathematician". That's my only point. And it does you no good to have a linear algebra library if you don't know how linear algebra works.
- dllthomas 11y agoGiven that the person you were replying to said, "I apply category theory and type theory all the time, and I'm sure the time I've put into studying algebraic topology and abstract algebra has shaped how I think about problems[,]" I don't think it's clear at all that they meant to express "web engineer, therefore not mathematician."
- deleted 11y ago[deleted]
- moron4hire 11y agoThat doesn't really mean anything
- dllthomas 11y agoWe can pick at the semantics, but they don't really matter. My point was that the pragmatic function of the above is quite clearly at odds with an attempt to distance the poster from mathematics.
- nbouscal 11y agoI didn't say I don't use and need math: I apply category theory and type theory all the time, and I'm sure the time I've put into studying algebraic topology and abstract algebra has shaped how I think about problems. I actually really enjoy linear algebra as well, and always enjoy the opportunity to learn more of it. What I said was that I've never had to do linear algebra in my code. Most of my work has been building web apps. Most of the domains that I've built those web apps for don't involve mathematical computations more complicated than multiplication, and when they have, I've usually just passed the task off to pre-existing libraries.
- jonnybgood 11y ago> solve enough problems to provide more benefit than cost What kind of problems do you have in mind where a statically typed lang would provide more benefit than cost over modern dynamically typed langs (erlang, clojure, etc.) or just in general?
- nbouscal 11y agoIn my experience, most application-level domain problems benefit significantly from strong static types. My most salient experience in the area is from working on a data analysis pipeline web app written in Haskell. The type checker regularly caught bugs that would have taken me hours to deal with if I had had to track them down after something broke at runtime. On the other side of the equation, again in my experience, the actual cost of a good static type system is minimal. Type inference means that you don't waste time on annotations, and the time you spend writing up the types themselves is time you would be spending anyway, since the primary difficulty is understanding the domain and the shape of your data.
- jonnybgood 11y agoThanks. It seems you are more concerned more about the software development experience and in that regard you see benefits. But I'm more curious and concerned about the benefits in solving real world problems. For example, in what way would Haskell be more beneficial in solving the problems that Erlang currently solves at Ericsson.
- deeviant 11y agoI generally feel that solving problems with software is the easy part. Solving in the way that is extensible, maintainable, bug-free as possible, and efficiently is the important part.
- Dewie3 11y ago> It seems you are more concerned more about the software development experience and in that regard you see benefits. But I'm more curious and concerned about the benefits in solving real world problems. I don't see the distinction.
- angersock 11y agoThe problem is that linear algebra is probably one of the most basic things you can do with a computer. If static typing isn't capable of offering useful help or even just has a few weird wrinkles, then something is very odd. For what it's worth, I've seen LA done in C++ with various templates and libraries, and so it's certainly possible in various ways.
- nbouscal 11y agoIt wouldn't surprise me at all if static typing was capable of offering useful help. If it can't today, I wouldn't be surprised to see us make progress over the next few years. I think interesting conversations could be had about why this problem is harder to model using type systems than other problems are. Where I get confused is when this is used as an argument against using static typing in general. By analogy: “Hammering nails is probably one of the most basic things you can do as a carpenter. If lathes aren't capable of offering useful help, then something is very odd.” I don't mean to mock, but it doesn't seem odd to me at all that not all tools are good for all purposes. What seems odd to me is trying to argue against the use of a tool that has proven itself in many different situations by pointing out that there exist situations it isn't useful in. Sure, that's true, but so what?
- metaphorm 11y agobut a programming language isn't a hammer or a lathe. its a workshop that is used to produce hammers and lathes and every other tool you will need. the criteria for judging the workshop is rather different than the criteria for judging the lathe.
- Solarsail 11y agoPL's as tools is a half-accurate analogy. If you're going to stretch it that far, shouldn't you use something more accurate? Or better, not use an analogy for something that detailed? Say, PL's are materials. They are something that useful things "tools" are fashioned out of. The properties of a material affect the entire thing built out of it, in modest but pervasive ways. Some programs are built in more than one language, this could be seen as an object built with different materials for different parts. Now, whether mainstream languages are analogous to different iron alloys, wood, concrete or plastic is a different discussion. (And maybe another exercise in taking an analogy too far...) Not sure where I saw this analogy first, since I can't find it on LtU...