Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #1877
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: functions as objects |
| Date | 2012-07-03 14:56 -0500 |
| Organization | albasani.net |
| Message-ID | <jsvitk$3t1$1@news.albasani.net> (permalink) |
| References | <d8061c1c-7668-4d55-8ab8-b70800a4752c@googlegroups.com> <function-values-20120702172625@ram.dialup.fu-berlin.de> |
On 7/2/2012 10:26 AM, Stefan Ram wrote: > bob <bob@coolfone.comze.com> writes: >> Doesn't it seem wasteful sometimes to create a class just >> because you want to pass a function as an argument? > > The meaning of words such as »class« and »function« depend > on the language. There are some languages, where functions > are first-class values, others where they are not. > yes, and languages where you don't need classes and object-instances to pass functions around. >> For instance, in Java, you might create a comparison class >> just to have one comparison function for sorting. > > Yes, but this also gives some more type-safety insofar as > two methods are not confused when they happen to have the > same or matching signature (as in duck typing) but different > semantics, because the class defined also needs to implement > a certain interface, which also yields documentation of the > semantics. > Java makes all this unreasonably awkward though (IMHO). it is much nicer to have faster/easier/lighter-weight alternatives, such as C function pointers, or C++ method pointers. or better yet, to have a language which (actually) supports closures. "type safety" is IMO often more of a "false concern", in that it often results in more pain and trying to work around the typesystem, than it actually saves in terms of subsequent debugging. not that the typesystem should allow things which are blatently wrong either, but it is a tradeoff. for example, there are many conditions which are not reported at all in C or C++, but treated as errors in Java, which would IMO be more appropriate maybe as warnings (particularly WRT implicit type-conversions). ...
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
functions as objects bob <bob@coolfone.comze.com> - 2012-07-02 08:15 -0700
Re: functions as objects Rui Maciel <rui.maciel@gmail.com> - 2012-07-02 17:42 +0100
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-03 14:56 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-04 09:28 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-04 10:08 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-04 18:12 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-04 14:02 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-04 22:20 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-04 19:42 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-05 11:30 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-05 10:33 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-06 10:50 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-06 08:32 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-06 16:45 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-06 10:48 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-07 21:28 +0200
Re: functions as objects "BartC" <bc@freeuk.com> - 2012-07-08 16:33 +0100
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-08 18:20 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-08 16:27 -0500
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-09 09:35 +0200
Re: functions as objects "BartC" <bc@freeuk.com> - 2012-07-09 09:48 +0100
Re: functions as objects "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2012-07-09 11:40 +0200
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-09 11:02 -0500
Re: functions as objects "BartC" <bc@freeuk.com> - 2012-07-08 16:34 +0100
Re: functions as objects BGB <cr88192@hotmail.com> - 2012-07-08 16:11 -0500
Re: functions as objects "BartC" <bc@freeuk.com> - 2012-07-08 23:35 +0100
csiph-web