Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Accessing a scalar value in another subroutine?

by BrowserUk (Pope)
on Sep 23, 2012 at 20:08 UTC ( #995243=note: print w/ replies, xml ) Need Help??


in reply to Accessing a scalar value in another subroutine?

I'm writing an OO perl program and I would like to create a "docstring", which describes the purpose of the method, then in a help method, access the docstring of each respective method

What is the purpose? Who are you providing this help to?

Are you suggesting that for a programmer -- who else would use this information -- to get help on how to use a particular method in their program, they first write another program that calls the help method with the name of the method they actually want to call?

Why would anyone do this rather than just look up the documentation; or -- heavens forfend -- look at the source?

To my eyes, this looks like the most fatuous piece of O'Woe (Order of Worshipful Over Engineers) rubbish I've seen in a long time.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


Comment on Re: Accessing a scalar value in another subroutine?
Re^2: Accessing a scalar value in another subroutine?
by Anonymous Monk on Sep 23, 2012 at 20:25 UTC
    To my eyes, this sound like the most fatuous piece of O'Woe (Order of Worshipful Over Engineers) rubbish I've seen in a long time.

    Considering that both Python and Common Lisp employ docstrings for the users of a class, I don't think "rubbish" would be an accurate term to describe my aspiration. I was merely asking if it was possible since a series of if/elsif/else constructs would have been less than elegant.
      Considering that both Python and Common Lisp employ docstrings for the users of a class,

      Could you demonstrate an example of their use?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

      don't feed the trolls!
Re^2: Accessing a scalar value in another subroutine?
by LanX (Canon) on Sep 23, 2012 at 20:38 UTC

      Yes. I read the docs; but would still like to a see an example of actual, practical use.

      The only example I've seen that makes any logical sense at all (to me), is the ability to query the information in a repl.

      But that extremely limited-use facility, does not justify burdening the runtime with the overheads it imposes, in a language who's runtime has facilities designed to support it.

      Emulating that limited-use facility in a language the does not have runtime facilities to support just imposes addition runtime costs for no conceivable benefits.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

        > Emulating that limited-use facility in a language the does not have runtime facilities to support just imposes addition runtime costs for no conceivable benefits.

        yes, avoiding runtime costs is the real problem.

        > The only example I've seen that makes any logical sense at all (to me), is the ability to query the information in a repl.

        docstrings are mostly oneliners (at least in elisp)

        Other applications are methodbrowsers/tabexpansions showing additional infos.

        Or tooltips in IDEs when hovering the mouse over a method call.

        PODs are not DRY, the subname must be repeated, docstrings are automatically at the right place.

        see also:Re^2: Accessing a scalar value in another subroutine?

        Cheers Rolf

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (15)
As of 2014-09-23 21:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (241 votes), past polls