473,511 Members | 16,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Define callback

Can someone provide a fromal definition of "callback"? I see this term used
often, and can usually understand the discussion where it's used, but I
would be hard-pressed to provide a formal definition.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jul 23 '05 #1
7 6988
* Steven T. Hatton:
Can someone provide a fromal definition of "callback"? I see this term used
often, and can usually understand the discussion where it's used, but I
would be hard-pressed to provide a formal definition.


Split a software system into two non-overlapping regions of code A and B.
An executable entity defined by A and passed as argument from A to some
routine in B for execution by B-code is a callback. In that sense member
functions can be and usually are callbacks, but most often "callback" is
used for and implies free functions and functor objects.

See also <url: http://www.google.com/search?q=define:callback>, and perhaps
also patents issued in the US... ;-)

XFUT [comp.programming].

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #2
Steven T. Hatton wrote:
Can someone provide a fromal definition of "callback"? I see this term used
often, and can usually understand the discussion where it's used, but I
would be hard-pressed to provide a formal definition.


see: http://www.newty.de/

Jul 23 '05 #3
Alf P. Steinbach wrote:
* Steven T. Hatton:
Can someone provide a fromal definition of "callback"? I see this term
used often, and can usually understand the discussion where it's used,
but I would be hard-pressed to provide a formal definition.


Split a software system into two non-overlapping regions of code A and B.
An executable entity defined by A and passed as argument from A to some
routine in B for execution by B-code is a callback. In that sense member
functions can be and usually are callbacks, but most often "callback" is
used for and implies free functions and functor objects.

See also <url: http://www.google.com/search?q=define:callback>, and
perhaps also patents issued in the US... ;-)

XFUT [comp.programming].


This is a perfectly legitimate question on comp.lang.c++ considering that I
find the term in C++ documentation and text, and it is not commonly used in
discussing other programming languages I have used. It seems to be an
artifact of C++'s C origins. For example, the term appears in the C++
standard, but not in the GNU Emacs Lisp Reference Manual, nor in the Java
Language Specification. In Pascal what you seem to be describing are
called procedural parameters and functional parameters.
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jul 23 '05 #4
Steven T. Hatton wrote:
[snip]
For example, the term appears in the C++
standard, but not in the GNU Emacs Lisp Reference Manual, nor in the Java
Language Specification. In Pascal what you seem to be describing are
called procedural parameters and functional parameters.


"The term" being a callback, Java does not mention it because it doesn't
have a direct analog. In current implementations, you pass an object
implementing an interface rather than a function, and functors have no
Java analog from C++.

In LISP, isn't a function considered a first class object just as a
class instance or list or atom, and so you can pass anything around as
data? Other similar languages like Mozart-oz and many scripting
languages do.

--Paul
Jul 23 '05 #5
Paul Bilnoski wrote:
Steven T. Hatton wrote:
[snip]
For example, the term appears in the C++
standard, but not in the GNU Emacs Lisp Reference Manual, nor in the Java
Language Specification. In Pascal what you seem to be describing are
called procedural parameters and functional parameters.


"The term" being a callback, Java does not mention it because it doesn't
have a direct analog. In current implementations, you pass an object
implementing an interface rather than a function, and functors have no
Java analog from C++.

In LISP, isn't a function considered a first class object just as a
class instance or list or atom, and so you can pass anything around as
data? Other similar languages like Mozart-oz and many scripting
languages do.

--Paul


The *idiom* may be used elsewhere. I would say it's used extensively in
Emacs Lisp, but not called "callback". I'm not sure it's used consistently
by C++ programmers. GoF calls parameterized behavior of an object (of class
type) a command pattern, and distinguishes between that and "callback"
which they say is the procedural language analog which 'command'
"replaces". That would imply that they would call
std::ios_base::event_callback a command pattern. But, I would say it is
closer to an observer pattern. Similar, but not identical to the Java
listener interface usage.

Part of my confusion comes from the networking notion of callback which
means if I hit a server (usually a dial up) with something that identifies
me, the server will then connect to a prespecified address(telephone
number).

It would seem that the meaning in the context of C++ is something like "a
function or functor that is assigned to a variable identifier so that it
will be invoked under prespecified conditions".
--
If our hypothesis is about anything and not about some one or more
particular things, then our deductions constitute mathematics. Thus
mathematics may be defined as the subject in which we never know what we
are talking about, nor whether what we are saying is true.-Bertrand Russell
Jul 23 '05 #6
Steven T. Hatton wrote:
Can someone provide a fromal definition of "callback"? I see this term used
often, and can usually understand the discussion where it's used, but I
would be hard-pressed to provide a formal definition.


It seems to me, in my rather limited experience, that a callback has some kind of temperal implication.

You can "register" a callback, i.e., at some point you specify the callback function, and a later point, call it.

You can also store state somewhere, and later on invoke an action based upon that state.

I'm not sure how to formally define it, but I think there has to be some form of temperal description within any definition, otherwise it's a just a function call.

At a higher level, perhaps a callback is a description you give to an entity, describing how it should inform you of some event (which occurs at a later point in time).

Discuss :-p

Ben
--
I'm not just a number. To many, I'm known as a String...
Jul 23 '05 #7
Steven T. Hatton wrote:
Can someone provide a formal definition of "callback"?
I see this term used often and can usually understand the discussion where it's used
but I would be hard-pressed to provide a formal definition.

http://en.wikipedia.org/wiki/Callback

http://wombat.doc.ic.ac.uk/foldoc/

http://www.bartleby.com/61/

In C++ these are function pointers

1. passed as an argument to another function,
2. stored in a data object (like a virtual function table)
for later use and
3. objects with overloaded operator() [functors].
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2685
by: Bill Davy | last post by:
I am working with MSVC6 on Windows XP. I have created an MSVC project called SHIP I have a file SHIP.i with "%module SHIP" as the first line (file is below). I run SHIP.i through SWIG 1.3.24...
1
7117
by: scott ocamb | last post by:
hello I have implemented a solution using async methods. There is one async method that can be invoked multiple times, ie there are multiple async "threads" running at a time. When these...
0
1724
by: vijaya | last post by:
I've to invoke a unmanaged dll fucntion in C# which uses a callback fucntion.The unmanaged dll fucntion is as follows **************************************** The Original Fucntion in the dll...
19
16270
by: Robert | last post by:
Greetings everyone, I was wondering if a const variable or object took up space. I know that a #define'd macro doesn't, as it's basically just interpreted by the compiler. If a const does take...
2
1781
by: MR | last post by:
help! I have an unmanaged DLL that I do not have the source code, so i can't recompile or make changes. the DLL requires a callback function. I would like to implement the callback method in a...
5
3404
by: Maxwell | last post by:
Hello, Newbie question here. I have a VS.NET 2003 MC++ (not C++/cli) project where I have a managed class reference in a unmanaged class...simple enough. To keep things short I am for the most...
6
7646
by: smmk25 | last post by:
Before I state the problem, I just want to let the readers know, I am knew to C++\CLI and interop so please forgive any newbie questions. I have a huge C library which I want to be able to use in...
0
2091
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
5
4289
by: Jef Driesen | last post by:
I have a C DLL that I want to use from a C# project. The C header file contains these declarations: typedef void (*callback_t) (const unsigned char *data, unsigned int size, void *userdata);...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.