Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It had never really occurred to me before writing that comment. Now I think it's really curious that not only there is that stark difference, but also that it's common across all programming languages (I'm not counting Excel, sorry) I'm aware of.

It might be tempting to think it's procedural vs declarative, but it's not really, you could procedurally evaluate that y should now be maintained to have such value. Admittedly you can't really do it any other way on declarative terms. But what allows you to do computation like that? Datalog maybe?

I'm ignoring Matlab/Octave/etc. because I'm not that familiar and of course (I assume) they work more like math. What's interesting is that everything else seems to do it differently; I'm not sure why or how that happened. Is it as simple as an early limitation (in terms of early computation and compilers) that stuck?



In matlab, the = sign is an assignment operator. I think it is really common because load/compute/store is what the hardware does, and so languages tend to be built around computing a value and then assigning it.

You could, I guess, in any language that allows operator overloading (Python would be a good one) define operators that actually return a function for computation, guess. This just seems like a really complicated way of defining a function, though.

Or possible a template library like Eigen could be thought of in terms of “building a computation.” Maybe CUDA has something like this? I’m not sure, at all.

An aspect for my case specifically, which is probably not a coincidence, is that I usually work with Electrical Engineering students. They’ll typically have seen some very light Verilog in some of their intro classes. I’m definitely not a Verilog expert, but you can use it to define combinatorial circuits—in that case you are literally describing the wires and gates that the computation flows through, so the left hand side does change based on the right hand side, continuously. At least until you write to a clocked register. And of course in a real circuit, there’d be some signal propagation time…




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: