Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^4: I dislike object-oriented programming in general

by pvande (Initiate)
on Oct 20, 2007 at 20:37 UTC ( [id://646214]=note: print w/replies, xml ) Need Help??


in reply to Re^3: I dislike object-oriented programming in general
in thread I dislike object-oriented programming in general

The reason why that doesn't work is a legacy error in the ECMAScript standard. By following a numeral with a dot, the parser expects that you're defining a floating-point value, rather than an integer. You can still call methods on it, however, if you disambiguate by wrapping it in parentheses first.
(5).foo();

Replies are listed 'Best First'.
Re^5: I dislike object-oriented programming in general
by tilly (Archbishop) on Oct 21, 2007 at 04:00 UTC
    Ah. That makes perfect sense.

    When you put it that way, I'm a little surprised that Ruby correctly understands this:

    class Fixnum; def hello () puts 'hi'; end; end; 5.hello;
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-24 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found