Talk:Inheritance/Single/C: Difference between revisions
→OO?: +1 |
No edit summary |
||
Line 20: | Line 20: | ||
:: That would probably be a good Idea. With what's here, the main purpose gets rather lost in the haystack.--[[User:Rldrenth|Rldrenth]] 13:40, 17 January 2010 (UTC) |
:: That would probably be a good Idea. With what's here, the main purpose gets rather lost in the haystack.--[[User:Rldrenth|Rldrenth]] 13:40, 17 January 2010 (UTC) |
||
::: +1 --[[User:Paddy3118|Paddy3118]] 16:59, 17 January 2010 (UTC) |
::: +1 --[[User:Paddy3118|Paddy3118]] 16:59, 17 January 2010 (UTC) |
||
:You'd be amazed at how many object systems have been implemented in C and other mostly procedural languages. OO is a useful enough design pattern that whole languages have been built around it, after all. In C, the implementer gets to choose ''how'' to implement it, instead of relying on the particular implementation built into the language. That's one reason we have Objective-C vs. C++. For example, the OO system built into the heart of Unix; what else is a device but a couple of classes (character, block) designed to be polymorphic on the open/close/read/write/ioctl interface, implemented as a couple big vtables? Most of the ad-hoc OO systems I've seen don't have general inheritance, relying instead on explicit delegation. --[[User:IanOsgood|IanOsgood]] 18:35, 17 January 2010 (UTC) |
Revision as of 18:35, 17 January 2010
OO?
First, I am not trying to be flippant here, obviously this C entry is a lot of work.
The task seems to me to only truly apply to object oriented languages. Would it not be better to simply state that C is not OO?
I was going to consider the following which would allow the inclusion of the C code
"Although C is not considered an OO language, you can do the following ...".
But knowing that C++ was designed to be both OO and C backward compatable (to some degree); and noting the brevity of the C++ entry compared to this C one, I can't see anyone actually doing something like this in C except to show that it can be done. Please, please don't get mad - it is hard to convey tone when writing. All I am trying to do is solicit comments on whether the current C entry is wise. (If I had gone to so much effort, I would have to think twice about someone suggesting it be removed). --Paddy3118 03:34, 17 January 2010 (UTC)
(P.S. Someone had noted how often people started out by saying "With all respect ..." then continued in a disrespectful tone. I have tried hard not to do that).
- I understand. I thought I'd do this more or less for pedagogical(sp?) purposes. Some comment about C not being a OO language is certainly appropriate. If you're familiar with the X window system, you'll see some similarities between what's in the XtIntrinsic library and some of this code. That was all a C based Object system, much more complete than this. --Rldrenth 05:46, 17 January 2010 (UTC)
- (My opinion) The "Unimplemented task" pages specifically list tasks marked as omitted, yet encourages people to try to implement them. Proofs of concepts such can illustrate where a problem may be solveable using a language, yet be particularly unidiomatic. In short, it can show how you might need to do something if you really have to, but also serve as a warning suggesting there may be a better way. In short, I think the example is wise, but as an example, not a recommendation. --Michael Mol 06:34, 17 January 2010 (UTC)
- Actually, there is a full object system for plain C: GObject. In fact, this implementation might be fruitfully replaced with one that uses GObject. —Underscore (Talk) 12:26, 17 January 2010 (UTC)
- You'd be amazed at how many object systems have been implemented in C and other mostly procedural languages. OO is a useful enough design pattern that whole languages have been built around it, after all. In C, the implementer gets to choose how to implement it, instead of relying on the particular implementation built into the language. That's one reason we have Objective-C vs. C++. For example, the OO system built into the heart of Unix; what else is a device but a couple of classes (character, block) designed to be polymorphic on the open/close/read/write/ioctl interface, implemented as a couple big vtables? Most of the ad-hoc OO systems I've seen don't have general inheritance, relying instead on explicit delegation. --IanOsgood 18:35, 17 January 2010 (UTC)