Vote up to Idea Avoid reserved words in parameter names Vote down to Idea Avoid reserved words in parameter names


This idea is active.
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.


Submitted by 1 year ago

Comments (5)

  1. 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.

    1 year ago
  2. 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.

    1 year ago
  3. Moderator

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

    1 year ago
  4. +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.

    1 year ago
  5. 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"

    1 year ago

Vote Activity Show


  1. The idea was posted
    1 year ago