JGWeissman comments on Course recommendations for Friendliness researchers - Less Wrong

62 Post author: Louie 09 January 2013 02:33PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (113)

You are viewing a single comment's thread. Show more comments above.

Comment author: JGWeissman 09 January 2013 06:23:05PM 1 point [-]

no functional language could have resolved the stack explosion issue

A functional language could compile to code that uses references to continuations (functions to call, with parameters) instead of the physical stack. See continuation passing style. (The language wouldn't need to use continuation passing style itself, the conversion would straightforward for the compiler to do.)

Comment author: OrphanWilde 09 January 2013 06:56:47PM -2 points [-]

That, to me, falls under "Trying to figure out ways around the constraints imposed by the language."

I suspect it would have made for even messier code, as well, provided it would have even worked for that particular problem. I was parsing a deliberately and ingeniously obfuscated document, and I was updating particular pieces of information based on information obtained in recursive references which, needless to say, were obfuscated, including false flag references which would get me incorrect information if followed; the falsity couldn't be determined locally, either, and required complex conditional comparisons to information contained in parent references. Some of the references were cyclical, to boot.

Comment author: JGWeissman 09 January 2013 07:11:01PM 4 points [-]

That, to me, falls under "Trying to figure out ways around the constraints imposed by the language."

Functional languages do not have inherent stack limits. A stack limit is imposed by a particular implementation of the language, and what I described is how a different implementation of the language could have a much larger stack limit, (constrained by total memory rather than memory initially allocated to the physical stack), with no difference in the source code because the compiler can make the transformation to continuation passing style for you.

The point is that this problem you had with XSLT does not generalize to all possible functional languages the way you think it does.

Comment author: OrphanWilde 09 January 2013 07:19:50PM 0 points [-]

Hm. Granted.

In fairness, I think it does generalize to most implementations.