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

The second code snippet doesn't use SSA. It just translates the first loop into IR and mangles the variable names. Here is an SSA version of that in the Scheme language.

  (let loop ((c c)) (if (< c 10) (loop (* c 3)) c))
Notice that this is stateless and also returns the final value of ā€œcā€ from the loop. People who use the below style have tended to find that it is much easier to reason about for more complicated looping structures.


I intended it to be mostly a joke. Many people equate LLVM IR with SSA.

I might even argue that easy to read and easy to reason about are opposites.

For the most part, languages like Python and Ruby can be very easy to read but difficult to understand precisely what actually happens at runtime.

Things like LLVM IR are much more explicit, making it easier to reason about but extremely difficult to read.

Maybe somewhere between is "pure" side effect free functional programs.




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

Search: