Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re^3: Get rid of the Indirect Syntax, please!

by dragonchild (Archbishop)
on Apr 19, 2004 at 12:53 UTC ( [id://346265]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Get rid of the Indirect Syntax, please!
in thread On the Improvement of Exegesis 12

I thought about it last night and realized my real objection to Perl6's indirect object syntax. The indirect syntax would now require you to know whether or not the first parameter is an object where it didn't in Perl5.

To me, the indirect syntax was a nice sugar when dealing with IO::File and friends (close $fh, in your example). That new() also played nicely was annoying, but I didn't care. I didn't have to know if $fh was an instance of IO::File or a GLOB or whatever. I just used it.

Now, I am required to know, because I have to put the colon on if it's an instance or not if it's not. I have to keep track of whether it's an object or not. To me, that kinda invalidates the whole reason for the thing.

Plus, do you really want close $*OUT:; all over your code, just to avoid $*OUT.close;?

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

Replies are listed 'Best First'.
Re^5: Get rid of the Indirect Syntax, please!
by adrianh (Chancellor) on Apr 19, 2004 at 13:01 UTC
    Plus, do you really want close $*OUT:; all over your code, just to avoid $*OUT.close;?

    Nope, but then again I don't because Larry tells us:

    The colon may be omitted if there are no arguments (besides the invocant):

    Y'know it's almost like somebody spent a lot of time thinking all of this through :-)

      This may be a question for TimToady, but why would it be omittable in the single-argument (and possibly others) case, but not in all cases? What's the counter-example, given the really nice dispatcher and multisubs?

      ------
      We are the carpenters and bricklayers of the Information Age.

      Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

        why would it be omittable in the single-argument (and possibly others) case, but not in all cases?

        Again - I've only skimmed A12 so I am probably wrong :-) However, consider:

        bar $foo, 1;

        Does this mean:

        ($foo.bar), 1

        or:

        $foo.bar( 1 );

        The colon disambiguates it:

        bar $foo: 1 == $foo.bar( 1 ); bar $foo, 1 == ($foo.bar), 1;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://346265]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-29 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found