Page 3 of 3 FirstFirst 123
Results 21 to 22 of 22

Thread: [JAVASCRIPT] Javascript Serialize

  1. #21
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by mburt View Post
    That tells you what type of data (variable name: boolean, integer, string, etc.) in the variable, not the type of keyword. Well, as far as I know.
    That's what I said but, why not? I mean why wasn't that included in its scope? Like:

    Code:
    alert(typeof try);
    should return 'undefined' in browsers before try was instituted and 'reserved' or 'keyword' in browsers where try has been implemented. That way no reserving would ever be needed until a use for something was devised and implemented.

    I realize that this would open up legacy code to errors in modern browsers but, that is already the case. I just think reserving words is a sort of anal compulsion on the part of the language developers with no thought as to how it will effect code written both before and after the reserved word finds a use.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #22
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I think you just answered your own question.
    Aye, I know it's possible, but the way you put it made it sound as if it would be easier if older browsers didn't die on the keyword, whereas in fact the difference would be negligable.
    They should have just left 'try' out of consideration entirely so that it could be tested for as an available method without causing older browsers to barf.
    The first piece of my code is what would be necessary to check for final if older browsers reserved it; the other is what's necessary as is. As you can see, both are pretty much equally ugly.

    With regards to using typeof for keywords: it may be possible, but since keywords are part of the language proper, they're not objects; it would be very difficult to tell how the developer intended to use the keyword in a given situation.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •