Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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:

Set WordObj = CreateObject("Word.Basic") WordObj.FileNew WordObj.EditClear

Perl5 requires you to write something like:

use OLE; my $wordObj = OLE->CreateObject("Word.Basic"); $wordObj->FileNew; $wordObj->EditClear;

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:

| wordObj | wordObj := OLE createObject: 'Word.Basic'. wordObj fileNew; editClear.

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.


In reply to Dots and cargo-cult programming by bikeNomad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-19 22:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found