API Technical Discussions

Avoid reserved words in parameter names

'for' and 'in' are reserved words in JavasSript avoiding these words in the parameter names would probably be a good idea, same thing with 'get' which could cause confusion with the http verb.

Tags

Submitted by

Stage: Active

Feedback Score

3 votes
3 up votes
0 down votes
Idea#137

Idea Details

Vote Activity

  1. Upvoted
  2. Upvoted
  3. Upvoted

Similar Ideas [ 4 ]

Events

  1. The idea was posted

Comments

  1. Comment

    Calvin,

    Thanks for your feedback. The Census API may be used with a number of different technologies including Objective-C, Java, PHP, JavaScript, Perl, Ruby, Python, SAS, R, Flex/Flash, and many more. Trying to avoid every keyword used in one of these while producing a usable grammar would be challenging indeed. I'm sorry you found the particular keywords we chose to be confusing and if there is something specific that you would like clarified I'd be happy to do that for you.

  2. Comment
    calvin.metcalf ( Idea Submitter )

    one of those words is a reserved word in almost all (if not all) of those languages. If you change up the Api at some point avoiding common reserved words like for, in, class, super, and while plus avoiding words that could be confusing (get request with get set to x) would lower the barrier for working with the data.

  3. Comment
    logan.t.powell
    ( Moderator )

    These are very good thoughts that we will take into consideration as we move forward. Your input and ideas are greatly appreciated Calvin!

  4. Comment
    cloydster

    +1 to Calvin's idea. I'm working on the census_api Ruby gem and we're presently using 'fields', 'level', 'within' as params since 'for' and 'in' are reserved.

    I'm not convinced those are the best terms but they're doing for now.

  5. Comment
    cloydster

    FYI, I've changed the gem terminology to 'fields', 'of', and 'within'. Is "of" a reserved word in other languages? Because it reads well in what will eventually be the Ruby gem syntax:

    @client.find( :total_population, of: {county: "Suffolk County"}, within: {state: "MA"} )

    read as "find total population of Suffolk County within Massacusetts"

Add your comment