Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: Re: Character++

by clintp (Curate)
on Sep 07, 2002 at 23:48 UTC ( #195934=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Character++
in thread Character++

Not sure why they decided not to implement -- on chars
Not every computational process is reversable, nor should it be. "clintp"-- probably would go to "clinto" you'd think.

"aa"-- might even logically go to "z", but then where should "a"-- go? "-a"? undef? ""? "`"? (how about on ebcdic systems?) Throw a warning (eeek! no warnings 'autodecrementascii'), throw an error (not remotely perlish!)?

Sometimes language features are nice, you acknowledge them, maybe use them, move on, and not think too hard about making them fit into every conceivable programmatic niche you can think of. Perl's gotten in trouble for this kind of nonsense before (pseudohashes, v-strings). Enjoy magical autoincrement. And remember putting magic under a microscope takes all of the joy out of it.


Comment on Re: Re: Re: Character++
Re: Re: Re: Re: Character++
by ignatz (Vicar) on Sep 08, 2002 at 00:03 UTC
    Couldn't you make the same arguments for 'Z'++? If you're gonna do the one, do the other.

    I figure that the rule of least surprise outweighs the fact that chr( ord('a') - 1) returns a backtick on most people's computers. ++ two equals three, -- two equals one; ++ 'b' equals 'c', -- 'b' equals '-1' Huhh??!!

    Sure, in the grande scheme of things, what's the diff. In my book this rates right up there with elsif. Another one of Perl's quirky little roadblocks that make people think.

    ()-()
     \"/
      `                                                     
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-12-25 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls