|Don't ask to ask, just ask|
Dots and cargo-cult programmingby bikeNomad (Priest)
|on Jul 14, 2001 at 21:12 UTC||Need Help??|
I had the pleasant opportunity to meet and talk with Dick Hardt of ActiveState on the Perl Geek Cruise. One of the points he made that I found interesting was that one of Perl5's failings was that it used a different syntax (->) for object method calls than other languages. He felt that since so many languages use a dot for this purpose, Perl was harder to use because you couldn't just copy example code and use it in your program. Of course, the code he was talking about was OLE Automation code under Windows, where you see examples for (for instance) Visual Basic. That is, assume you had the following VB example code:
Perl5 requires you to write something like:
This seemed to me at the time like a niche concern, and one that could be easily taken care of by a reasonable editor (I could make a "paste as Perl5" macro easily in Vim), or a bit of programming. After all, who's in such a hurry to make a program that they can't stop and think about what they just pasted in? But I thought it was an interesting point.
Then somewhat later, I was reading David Simmons' posts on comp.lang.smalltalk about the great work he was doing on the Smallscript product (essentially a version of Smalltalk, but with lots of language improvements). Smallscript runs on the Microsoft .NET platform.
David also mentioned that he'd added the dot syntax, for much the same reason (copying of example code). Recall that Smalltalk normally would use something like this:
Now I see that Perl6 wants to start using the dot instead of the arrow (and change concatenation to the tilde (~)).
Apparently, the idea that people have to be able to paste OLE example code into their programs directly has taken root among a fair number of smart people in the Perl community and elsewhere. While I have no particular preference one way or the other with respect to the proposed Perl6 syntax, I do think that it's curious that this belief is so prevalent. It may be something Microsoft is promoting, or it may have come from observation of users in the field.
What bothers me about the belief is that the language designers are attempting to facilitate cargo-cult programming by doing this. Perhaps they feel that their languages won't compete well with other languages that use dots (as I recall, Python, Java, C++ (refs), VB, and Ruby all use dots for method calls). Perhaps they want to extend the reach of their languages into the ranks of the VB macro/spreadsheet community. I don't know. But it seems to me that changing language syntax to match Visual Basic should be low on people's priority lists.