Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

70%
+5 −1
Q&A Terms for types of functions with respect to side effects

I don't think there are any formal names for the various versions you list. First of all, please note that output in a programming context most often refers to printing something on a screen or to...

posted 9mo ago by Lundin‭  ·  edited 9mo ago by Lundin‭

Answer
#2: Post edited by user avatar Lundin‭ · 2023-08-10T11:53:26Z (9 months ago)
  • I don't think there are any formal names for the various versions you list.
  • First of all, please note that _output_ in a programming context most often refers to printing something on a screen or to a file, or updating graphics. "Function output" is not a common programming term - almost every language instead terms such function _return value_ or perhaps "result".
  • That being said, some semi-formal, widely accepted "language-agnostic" terms do exist:
  • - _Procedure_ or _subroutine_ often refers to functions which do not return anything. I think this might originate from Pascal and/or Ada. [C family languages](https://en.wikipedia.org/wiki/List_of_C-family_programming_languages) tend _not_ to use either of these terms but call everything functions.
  • - _Re-entrant_ refers to a function which can be safely used in a multi-thread program, because it has no side effects.
  • - _Thread-safe_ refers to a function which can be safely used in a mult-thread program. It has side effects, but those are guarded with semaphore/mutex or similar.
  • - _Member function_ or _method_ is something that interacts with a given object. It may have side effects, including updating the object data.
  • Many OO languages also support "read-only" member functions, which are guaranteed not to modify the current object (but may contain other side effects). _Immutable objects_ is another common term used for objects that are never modified after creation - and so a function taking an immutable object as parameter cannot/will not modify that object (but may contain other side effects).
  • I don't think there are any formal names for the various versions you list.
  • First of all, please note that _output_ in a programming context most often refers to printing something on a screen or to a file, or updating graphics. "Function output" is not a common programming term - almost every language instead terms such function _return value_ or perhaps "result".
  • That being said, some semi-formal, widely accepted "language-agnostic" terms do exist:
  • - _Procedure_ or _subroutine_ often refers to functions which do not return anything. I think this might originate from Pascal and/or Ada. [C family languages](https://en.wikipedia.org/wiki/List_of_C-family_programming_languages) tend _not_ to use either of these terms but call everything functions.
  • - _Re-entrant_ refers to a function which can be safely used in a multi-thread program, because it has no side effects.
  • - _Thread-safe_ refers to a function which can be safely used in a mult-thread program. It has side effects, but those are guarded with semaphore/mutex or similar.
  • - _No-op_ is often used informally to describe functions which do not perform anything and have no side effects. Likely originating from the common assembler `nop` instruction (no operation, do nothing).
  • - _Member function_ or _method_ is something that interacts with a given object. It may have side effects, including updating the object data.
  • Many OO languages also support "read-only" member functions, which are guaranteed not to modify the current object (but may contain other side effects). _Immutable objects_ is another common term used for objects that are never modified after creation - and so a function taking an immutable object as parameter cannot/will not modify that object (but may contain other side effects).
#1: Initial revision by user avatar Lundin‭ · 2023-08-10T11:49:08Z (9 months ago)
I don't think there are any formal names for the various versions you list. 

First of all, please note that _output_ in a programming context most often refers to printing something on a screen or to a file, or updating graphics. "Function output" is not a common programming term - almost every language instead terms such function _return value_ or perhaps "result". 

That being said, some semi-formal, widely accepted "language-agnostic" terms do exist:

- _Procedure_ or _subroutine_ often refers to functions which do not return anything. I think this might originate from Pascal and/or Ada. [C family languages](https://en.wikipedia.org/wiki/List_of_C-family_programming_languages) tend _not_ to use either of these terms but call everything functions.

- _Re-entrant_ refers to a function which can be safely used in a multi-thread program, because it has no side effects.

- _Thread-safe_ refers to a function which can be safely used in a mult-thread program. It has side effects, but those are guarded with semaphore/mutex or similar.

- _Member function_ or _method_ is something that interacts with a given object. It may have side effects, including updating the object data.

Many OO languages also support "read-only" member functions, which are guaranteed not to modify the current object (but may contain other side effects). _Immutable objects_ is another common term used for objects that are never modified after creation - and so a function taking an immutable object as parameter cannot/will not modify that object (but may contain other side effects).