On 22/05/2011, at 11:17 PM, Frank Wales wrote: > Blimey, are we top-posting or bottom-posting in this discussion? Anyway... > > The original question was about whether there were studies on > the effect of 'magic' features, but we seem to have devolved into > a show-and-tell of them instead. > > I wonder whether one person's 'magic' is another person's failure > to RTFM,
Case in point: in Erlang an anonymous function can have more than one clause, e.g., fun (X, Y) when X >= Y -> X ; (X, Y) when X < Y -> Y end There has recently been a long thread in the Erlang mailing list triggered by one user's exposure to this. Amongst other things he was highly critical of the Erlang documentation for not explaining that this was possible. If you look in the Erlang reference manual, the very first example in the section on anonymous functions shows multiple clauses. It even precedes any of the text in that section. Apparently "the Erlang documentation" was not, by that programmer, thought to include the reference manual. > Perhaps it's possible to discover when the benefit of magic > is outweighed by the curse of the confusion it also brings. > But the real trick would then be to get language designers to > pay attention to the results of such work, and to make their > languages more usable by being less magical. "A sufficiently advanced technology is indistinguishable from magic." A serious question: how do we -tell- whether something should count as a really useful feature and when it should count as magic? Should we always be thinking about the needs of people working in a language they have not studied thoroughly, or is it ever acceptable to say "well, you have to read this ~200 page book first, and keep dipping into it until you feel comfortable?" Some of he examples I've seen mentioned in this thread are clear discontinuities in the language, where are some arbitrary point things of the same kind stop working one way and start working another. The Erlang example above is not one of those: it's a case where _every_ control structure in the language allows multiple clauses, and anonymous functions are _not_ an exception, even though that's unusual across languages. Can something like that count as magic? -- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).