Talk:Function frequency: Difference between revisions

From Rosetta Code
Content added Content deleted
(Propose function -> identifier)
(Note on slight extension of task description)
Line 30: Line 30:
: The task obviously doesn't really care about very exact definitions, why not just take the liberty and do whatever you think fits the bill? The stated goal is to make a tool that may (or may not, even) help in analyzing a piece of source code, just keep that in mind and do something reasonable. --[[User:Ledrug|Ledrug]] 12:51, 9 December 2011 (UTC)
: The task obviously doesn't really care about very exact definitions, why not just take the liberty and do whatever you think fits the bill? The stated goal is to make a tool that may (or may not, even) help in analyzing a piece of source code, just keep that in mind and do something reasonable. --[[User:Ledrug|Ledrug]] 12:51, 9 December 2011 (UTC)
:: Right. I would propose to change "function" to "identifier" or "token", both in the task's title and in the description (unfortunately, I don't know how to do the former), and leave it open to the individual implementation to be more specific. --[[User:Abu|Abu]] 08:25, 10 December 2011 (UTC)
:: Right. I would propose to change "function" to "identifier" or "token", both in the task's title and in the description (unfortunately, I don't know how to do the former), and leave it open to the individual implementation to be more specific. --[[User:Abu|Abu]] 08:25, 10 December 2011 (UTC)
::: OK, added that, and explained the intent a bit --[[User:Abu|Abu]] 10:50, 11 December 2011 (UTC)

Revision as of 10:50, 11 December 2011

Specification

It seems to me this could be better specified. For instance this looks likes it is to be run against a source file. However, it could equally be run against an entire library or collection. For instance what are the statistics for a commonly used public library or Rosetta. I know this complicates things and I'm not asking to change the tsak itself. Just to clarify the intent. --Dgamey 12:23, 7 December 2011 (UTC)

What is a "function"?

Questions to ponder:

  1. Is a macro a "function"?
  2. Is a parse-time word a "function"?
  3. Is a compiler directive a "function"?
  4. Is a lookup table a "function"?
  5. Is a lookup table a "function" in a language where lookup tables and procedure calls use the same syntax when mapping arguments to results?
  6. Are functions which are built into the language "functions"?
  7. Are language built-ins which are not functions (for example, the assignment operator) "functions"?
  8. Are constants "functions"?
  9. Are operations which produce constant results that take (and ignore) their arguments "functions"?
  10. Are constants functions in a language where language syntax allows numbers to take (and ignore) arguments "functions"?
  11. Are procedures with side effects "functions"?
  12. Are procedures which return void "functions"?
  13. Are OS calls "functions"?
  14. Are words which have not been defined "functions"?
  15. Are words which are not yet defined "functions" if they will later be defined to be procedures?
  16. Are words which are not yet defined "functions" if they will later be defined to be constants?
  17. Are words which are not yet defined "functions" if the language allows function definitions to be loaded lazily but does not allow constant definitions to be loaded lazily?

(All of these questions have languages where they are pertinent issues, though not all of these issues will be pertinent in the same language for any language that I know of). --Rdm 20:03, 8 December 2011 (UTC)

strncmp() or memcmp() in C sometimes is compiled into "repz cmpsb" without jumping(CALL) anywhere in x86 assembly, so it's not a function!? I dont know :) --Spekkio 08:32, 9 December 2011 (UTC)

The task obviously doesn't really care about very exact definitions, why not just take the liberty and do whatever you think fits the bill? The stated goal is to make a tool that may (or may not, even) help in analyzing a piece of source code, just keep that in mind and do something reasonable. --Ledrug 12:51, 9 December 2011 (UTC)
Right. I would propose to change "function" to "identifier" or "token", both in the task's title and in the description (unfortunately, I don't know how to do the former), and leave it open to the individual implementation to be more specific. --Abu 08:25, 10 December 2011 (UTC)
OK, added that, and explained the intent a bit --Abu 10:50, 11 December 2011 (UTC)