Thanks for the link to draftin. Looks very useful. Fwiw, the op's work seems equivalent to draftin's "Hemingway mode" .. which (if I understand it right) doesn't permit any edits at all.
Interesting experiment to forbid editing. Though the delete key doesn't work, cut-copy-paste does. Forbid that too! ... otherwise I'll be tempted to cheat :)
> Are there any other languages that allow the calling scope to specify how lower-level functions handle errors without unwinding the stack?
another possible answer - Erlang.
While the look of the condition/restart scheme may be very different, such a condition/restart protocol can be implemented as message passing with a known global "condition handler" process I think.
A "raise" function can be implemented as a message-send to the condition handler process followed by an immediate wait-for-response. The handler process may terminate the raising process, replace its value with something, etc. depending on the installed handlers.
> Are there any other languages that allow the calling scope to specify how lower-level functions handle errors without unwinding the stack?
While it isn't a mainstream language by any means, a scheme dialect called muSE [1] that I developed for writing logic for automatic music video construction supports such resumes and retries. [2]
--
edit: I just saw that the clojure library "ribol" has an api design similar to muSE's in principle. A couple of design comments though -
1. The "on blah blah" is too much syntax for this. It prevents direct sharing of handlers between similar situations. Function argument pattern matching ought to be enough.
2. The retry options mechanism is somewhat limited - the options seem to apply only at the raise point itself (disclaimer: I've only had a quick glance at ribol). It is more useful to have multiple retry options at different scopes so you can partially unwind, try something, if that doesn't work unwind some more (perhaps involving cleanup), try something else, etc.
I think muSE's design is better on both these fronts.
If any of you actually need such constraint satisfaction in javascript, checkout my fd.js library [1]. You'll find einstein, sudoku and other puzzles in the tests.js file.
I also recommend a Mozart/Oz style interactive search tree explorer made by a student [2] .. built on fd.js.
Agree with your "slam dunk" argument. Though net neutrality seems utopian in principle, from another perspective the providers with the infrastructure seem to be simply asking for the market to decide the use of their private infrastructure than some abstract principle.
Then again, we can make the same argument about utility providers. If a private electricity provider asks for a share of the payment of the video being served using the electricity that they supply, where should this stop?
I'm beginning to think that we'll eventually end ip with a middle ground where some usages of communication infrastructure are regulated (such as emergency response) and some others are in the market.
While folks are arguing about whether such a breakage of net neutrality will be bad for consumers, are there at least any reasonable market simulations that point out good/bad out omes for each party involved, includin consumers?
I find the "premortem" way of looking at it psychologically more appealing. When asked to "think of all the dangers", I can imagine a tendency existing to bury one's head in sand and say "what danger? What risk?". We also know of "hindsight bias", and I wonder whether a premortem would be a way to exploit it rather than be a victim to it.
At least, I'm not rational enough to reason identically whether I've been primed with death or just the risk of death. So I think this would be a useful exercise for me (and those like me).
There is, for me, a peculiar connection between cameras and pc computing power (I used to work for muvee technologies). As computing power grows, I've been quite frustrated with how he extra tends to get eaten up by a higher qualiy video format. 320x240 was enough at one point and 300mhz machines could deal with these well. Then came DV at 720x576@30fps, needing faster machines. We have HD today at 1920x1080. Each step has so far been 4x bump in resolution. We're now going to get hit by another 2x bump - 4k video, and then perhaps a bump to the frame rat to 60fps (or at least 48fps).
Today's "normal pc" compute power is inadequate for 4k video ... Unless you plug in a decent gpu and your machine includes a decent bandwidth to that gpu.
Given that parents have always wanted to film thir kids at the highest quality they can afford, where do you thnk this trend might take us industry wise?
Edit: if i cannot type out this post error free, mobiles phons suck as PC replacements ;)
A meta comment - I'm reading a lot of the "use the right tool for the job and stop arguing" statement in language/framework/system/machine comparison threads these days.
I find the "right tool for the job" to be a total conversation stopper. It stops the bikeshedding type arguments, true, but it also stops potentially illuminating comparisons. Can we, as a community, agree to stop bringing it up in comparison arguments?
Imagine a new programming language and system being presented in an article. It is healthy and useful for the article to say "We designed system X so it is easier to express Y kind of programs. A, B, C are the complications encountered when doing the same with systems I, J, K." rather than "We designed system X to express Y kind of programs. We like it, but if you don't, use the right tool for your job."
While many of us are polyglots, we do seek to minimize the number of parts when building a system, so such comparisons are often meaningful at some level.
I used to frequent the bay area around 2000 when I worked for a Singapore based startup who setup their HQ there. As I didnt have a driving license, I used to take public buses from San Mateo to Burlingame, and make train trips to SF.
I was given the standard cautionary rules by many, but I have to say that in all that commuting, I never felt threatened even once. Normal folks commuted by bus too. However, there were also quite a few who we were "challenged" in various ways, but still had regular jobs at cafes and such. Since my commute schedule was fixed, I became familiar with them and realized that though there wasn't much conversation going on, the regulars were all familiar with each other.
On one occasion, one guy sat next to me and poured his heart out about how his girl friend ditched him years ago and how upset he's been over it for many years. Then, when a stop came, he wordlessly walked out the door and held it open for one of the regulars. This lady had her eyes to the floor the whole time and after she'd got down, said "bye" to him. He returned a "take care", came back to his seat and resumed his story with me.
I admit I was somewhat uneasy on the bus commutes initially, but this incident totally changed me. Actually, I'd never seen this quality of spontaneous kindness among "normal" folks during my stay there .. and was humbled greatly myself.
I always recall this incident (and all those commutes) fondly. I now think most "normal" city folks who curse each other on every misstep, cant tolerate a couple of seconds delay on the road, who never seem to get a thought to extend themselves out of their pitifully small and limited bodies to someone else; as the folks who are "challenged".
So, coming back on topic, at least start a conversation with the regulars on your commutes.
Recently, there was a paper talking about this aspect of quantum theory - http://xxx.lanl.gov/abs/1111.3328 ... well, it was "recently" and fresh in my mind, but it appears to be back in 2011 :)
Dealing with process coordination using the resolution of logical variables gave me a refreshing new perspective. The finite domain constraint system design in Oz is an awesome example of this in action.
An interesting tidbit - the Mozart/Oz team invented "pickling" before it caught on with Python.
It was BASIC and assembly initially, on the zx spectrum (at a friend's). A gentleman introduced me to BASIC and showed me a loop with an "I = I + 1" which made me argue with him about how that cannot be true :) .... and then I suffered the permanent imperative head damage before waking up many years later.
Though the beginnig was with a blow to the head, I did enjoy the immediacy of BASIC.
Be it stoicism or any school of thought that recommends a way of life, the key fallacy to avoid fall into is that it is these principles that make you happy, or productive, or wealthy, or healthy or whatever. While such principles can be temporarily crutch for a person, over time the crutch gains the status of legs instead of people using it to learn to walk.
My mind keeps coming up with generalizations all the time. For example, "the more space you have for your family, the less valuable time together you spend". Needless, useless generalizations like this about just about everything. So I've formed a mental habit of just pausing and asking "really?" .. and soon these just go poof.
In other words, I automatically question the validity of any concept I construct. This way, I'm free to stick to one temporarily and have no qualms about abandoning concepts that aren't valid for me.
The nice thing about Derek's post is that he's just posing the question and leaving it to the reader to ruminate on what answer would mean to them. The skill to pick up here is to ask these kinds of questions ... like all the time.
True .. and while I revisit the linked references some of which I'm familiar with (fran and ilk, for ex), I'd like to point out that having the list of references at the bottom of the post of something would be much more handy than scanning the text for normal words with weird colours. The traditional paper format is awesome for readability when dealing with material that references a lot.
On a similar note, it would really help if the website for the Wolfram Programming Cloud had just one bloody-awesome/blow-me-away example or tutorial that would make it accessible to a lot of capable programmers who may not have used a Mathematica Notebook.
Folks who haven't used Mathematica ever - I recommend the Home Edition. Yes, it is worth paying for it!
At its core, a programming environment provides a link between a formal system and some aspect of our world. You could think of a general purpose Computer as providing a link between any formal system and the aspects of our world that it ties int, but we can limit ourselves to programming environments for simplicity of discussion.
With that perspective, we can ask what representations of a formal system do we find easy to manipulate in ways that produce results that are significant for us (in a specific problem context).
A visual representation would certainly be a better match for a spatial problem domain (Sutherland's work, for example). Similarly, an audio representation can work well for an audio domain (ex: beardyman's realtime performance system he presents in his ted talk). Likewise, I'm quite sure a system for exploring cuisine art would match a "smell representation".
The notion of a "universal turing machine" guarantees that all of these representations can be mapped to that of a symbol stream. That is a mathematical result, but which representations appeal to humans involved in various kinds of work is not a mathematical question - it is a HCI question.
Not to mention that when such an accurate simulation becomes possible, special relativity gets violated - you can know whats happening anywhere before a signal can travel from there to you.