←back to thread

263 points todsacerdoti | 1 comments | | HN request time: 0.211s | source
Show context
userbinator ◴[] No.44506358[source]
Somewhat less frequently, I also hear "invoke" or "execute", which is more verbose but also more generic.

Incidentally, I find strange misuses of "call" ("calling a command", "calling a button") one of the more grating phrases used by ESL CS students.

replies(7): >>44506396 #>>44506421 #>>44506500 #>>44506580 #>>44510160 #>>44510878 #>>44511635 #
pansa2 ◴[] No.44506396[source]
> strange misuses of "call"

My favourite (least favourite?) is using “call” with “return”. On more than one occasion I’ve heard:

“When we call the return keyword, the function ends.”

replies(4): >>44506779 #>>44506910 #>>44506977 #>>44511912 #
jamesfinlayson ◴[] No.44506779[source]
I remember someone in university talking about the if function (which ostensibly takes one boolean argument).
replies(7): >>44506886 #>>44506915 #>>44507329 #>>44508128 #>>44509940 #>>44512872 #>>44516315 #
Zambyte ◴[] No.44509940[source]
If takes two or three arguments, but never one. The condition is the one made syntactically obvious in most languages, the consequent is another required argument, and the alternative is optional.
replies(1): >>44510291 #
dylan604 ◴[] No.44510291[source]
Huh? if (true) {} takes precisely one argument.
replies(2): >>44510378 #>>44514732 #
1. andriamanitra ◴[] No.44514732[source]
Depends on the language! If "if" wasn't a keyword, in Ruby that would be calling a method that takes one positional argument and one block argument, such as `def if(cond, &body) = cond && body.call`. In PureScript that could be a call to a function with signature `if :: Boolean -> Record () -> _`.

But I assume the comment you were replying to was not referring to the conditional syntax from C-like languages, instead referring to a concept of an if "function", like the `ifelse` function in Julia [1] or the `if` form in Lisps (which shares the syntax of a function/macro call but is actually a special form) [2], neither of which would make sense as one argument function.

[1] https://docs.julialang.org/en/v1/base/base/#Base.ifelse

[2] https://www.gnu.org/software/emacs/manual/html_node/elisp/Co...