Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6885117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:35:41+00:00 2026-05-27T05:35:41+00:00

A simple question: Which is the best way to document for example the types

  • 0

A simple question: Which is the best way to document for example the types of function parameters or return values in dynamic languages? Adding comments after each function definition?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:35:42+00:00Added an answer on May 27, 2026 at 5:35 am

    The conventions depend more on commenting/documentation features of the language than on the static/dynamic typing nature of the language. Even more do they depend on the documentation tool used, as often multiple different documentation tools exist for one language. Although in statically typed languages you don’t have to document the technical types of the parameters, you still need to document the meaning and purpose.

    A large group of languages with C-derived syntax use Javadoc style comments. For example in PHP:

    /**
     * Calculates the area of circle.
     * @param float $radius The radius of circe.
     * @return float The area
     */
    function area($radius) {
    

    The YARD tool for Ruby uses a similar convention:

    # Calculates the area of circle.
    # @param [Number] radius The radius of circe.
    # @return [Number] The area
    def area(radius)
    

    I guess on the whole, this is the most mainstream style.

    In several languages you just write pretty much free-form comments, using bulleted lists etc when you need to document list of parameters. An interesting example in this regard is Perl with its pod comments:

    =item stuff(radius)
    
    Calculates the area of circle.
    
    =cut
    
    sub stuff {
    

    Contrary to the examples provided by ralu, I think it’s more common to have documentation before the function definition… but in the end it all depends on the language.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question, which is the best way to make sure that the app works
Simple question - In c++, what's the neatest way of getting which of two
Simple question. What is the best way to turn a CGPoint into a GLKVector?
I have a pretty simple question which perhaps someone familiar with Server/Client design &
A fairly simple question for which I have a guess, but I can't find
It is a simple question to which I am not able to find the
simple question... Given I have an ASP.NET site, which uses a [custom] RoleProvider, Is
I have a simple question and wish to hear others' experiences regarding which is
A simple question. I have an ASP.NET web application which contains several assemblies and
A simple question, how would I go about declaring a clause which would produce

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.