473,657 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C Object System

I just put the draft of my paper on the web:

http://cern.ch/laurent.deniau/html/c...la07-draft.pdf

I would be interested by any feedback from C programmers (with little OO
knowledge) to improve the paper quality, even if I don't know yet if the
paper will be accepted. It is not intended to be a manual nor an
introduction to OOP. Just to mention it (not in the paper), my
programming background is 10+ years of C/C++.

Kind regards,

ld.

ABSTRACT:
The C Object System (COS) is a recent framework entirely written in C
which implements high-level concepts available in CLOS, OBJECTIVE-C and
other object-oriented programming languages: uniform object model
(class, metaclass and property-metaclass), generics, multimethods,
delegation, exceptions, contracts and closures. It relies on the
programmable capabilities of C to extend its syntax and to implement the
aforementioned concepts as first-class objects. COS aims at satisfying
several general principles like simplicity, flexibility, extensibility,
efficiency and portability which are rarely met in a single programming
language. Its design is tuned to provide efficient and portable
implementation of message dispatch and message forwarding which are
the heart of code flexibility and extensibility. With COS features,
software should become as flexible and extensive as with scripting
languages and as efficient and portable as expected with C programming.
Likewise, COS concepts should significantly simplify adaptive,
aspect-oriented and subject-oriented programming as well as distributed
systems.
Apr 18 '07 #1
62 4331
On 18 huhti, 18:37, Laurent Deniau <laurent.den... @cern.chwrote:
I just put the draft of my paper on the web:

http://cern.ch/laurent.deniau/html/c...la07-draft.pdf

I would be interested by any feedback from C programmers (with little OO
knowledge) to improve the paper quality, even if I don't know yet if the
paper will be accepted. It is not intended to be a manual nor an
introduction to OOP. Just to mention it (not in the paper), my
programming background is 10+ years of C/C++.

Kind regards,

ld.

ABSTRACT:
The C Object System (COS) is a recent framework entirely written in C
which implements high-level concepts available in CLOS, OBJECTIVE-C and
other object-oriented programming languages: uniform object model
(class, metaclass and property-metaclass), generics, multimethods,
delegation, exceptions, contracts and closures. It relies on the
programmable capabilities of C to extend its syntax and to implement the
aforementioned concepts as first-class objects. COS aims at satisfying
several general principles like simplicity, flexibility, extensibility,
efficiency and portability which are rarely met in a single programming
language. Its design is tuned to provide efficient and portable
implementation of message dispatch and message forwarding which are
the heart of code flexibility and extensibility. With COS features,
software should become as flexible and extensive as with scripting
languages and as efficient and portable as expected with C programming.
Likewise, COS concepts should significantly simplify adaptive,
aspect-oriented and subject-oriented programming as well as distributed
systems.
Very interesting paper and lots of mind-food. I'm not sure if C is
suitable for re-decoration as we have C++, but nevertheless it's a
thing to consider. I have to study this one.

Apr 18 '07 #2
Laurent Deniau a écrit :
I just put the draft of my paper on the web:

http://cern.ch/laurent.deniau/html/c...la07-draft.pdf

I would be interested by any feedback from C programmers (with little OO
knowledge) to improve the paper quality, even if I don't know yet if the
paper will be accepted. It is not intended to be a manual nor an
introduction to OOP. Just to mention it (not in the paper), my
programming background is 10+ years of C/C++.

Kind regards,

ld.

ABSTRACT:
The C Object System (COS) is a recent framework entirely written in C
which implements high-level concepts available in CLOS, OBJECTIVE-C and
other object-oriented programming languages: uniform object model
(class, metaclass and property-metaclass), generics, multimethods,
delegation, exceptions, contracts and closures. It relies on the
programmable capabilities of C to extend its syntax and to implement the
aforementioned concepts as first-class objects. COS aims at satisfying
several general principles like simplicity, flexibility, extensibility,
efficiency and portability which are rarely met in a single programming
language. Its design is tuned to provide efficient and portable
implementation of message dispatch and message forwarding which are
the heart of code flexibility and extensibility. With COS features,
software should become as flexible and extensive as with scripting
languages and as efficient and portable as expected with C programming.
Likewise, COS concepts should significantly simplify adaptive,
aspect-oriented and subject-oriented programming as well as distributed
systems.
Salut Laurent!

Very interesting paper.

Some comments after a fast first reading:

A: EXCEPTION HANDLING
------------------
1) lcc-win32 implements try/catch exception handling in
a slightly similar way than what you propose.
For instance

void fn(void)
{
char *p=NULL;
unsigned code;
__try {
*p = 0;
printf("No exceptions\n");
}
__except(code=G etExceptionCode (),EXCEPTION_EX ECUTE_HANDLER) {
printf("Ooops, there was a problem with this program.”);
printf("Error code: %#x\n",code);
}
return 0;
}

This could be made functionally equivalent to what you propose with a
switch statement within the __except clause, that would handle the
different values of the exception being thrown.

Of course your exception handler handles not just an integer code but
(apparently) a message to an object/class...

This is easy to do under windows, but very difficult to do in systems
that do not support exception handling natively like linux, for
instance. I have found no easy solution under linux, but it is true
that I haven't researched a lot about how could be done.

2: Another subject, within the exception handling theme is the behavior
concerning traps. Are traps exceptions? As you can see above, for
lcc-win32 the answer is yes. For C++ it is no, as far as I know.
(Please correct me if I am wrong the C++ experts here).
I would like to know the position of COS about this subject.

B: DESIGN BY CONTRACT
------------------

I have developed an extension for lcc-win32 to implement DBC, but after
some thought about it, I can't see the advantage of that with the simple
method of just using assert. Preconditions can be very easily
implemented with asserts before the main body of the function, post
conditions can be done in a similar easy way by adding assertions after
the body of the function.

Since the C Comitee has started examining the Microsoft proposition for
a safer C library, I implemented the "require" macro using that proposed
mechanism, what is surely an improvement over just the assert macro.

The 'require' macro would fit nicely as the precondition part of DBC.

Obviously your proposal is different than that, since you advocate oo
programming, and the preconditions/post conditions are part of the
class hierarchy, and accordingly executed probably from the most
specific to the least specific class constraints (or the other way
around, I do not remember seeing this in your document).

C: GENERICS
--------
It is difficult to understand what do you want from the description of
generics in your document. You refer to objective C behavior as
explanation but with my very limited knowledge of Objective C this
leaves quite a lot of dark places...
Generics within the context of lcc-win32 are understood as a single
function that can have different implementations for different
arguments. This corresponds (more or less, probably less than more) to
the C++ usage. Your definition of generics seems to be a function that
receives an unidentified object as arguments, tests if the object
responds to some message and if it does it sends the message...
I do not see quite the interest of that, and it would be nice if you
would use a more down to earth example for this.


jacob

P.S. I referred above to 'lcc-win32'. That is an experimental
compiler system available at

http://www.cs.virginia.edu/~lcc-win32
Apr 18 '07 #3
Laurent Deniau wrote:
I just put the draft of my paper on the web:

http://cern.ch/laurent.deniau/html/c...la07-draft.pdf

I would be interested by any feedback from C programmers (with little OO
knowledge) to improve the paper quality, even if I don't know yet if the
paper will be accepted. It is not intended to be a manual nor an
introduction to OOP. Just to mention it (not in the paper), my
programming background is 10+ years of C/C++.
Given your background, I have to ask why? The features you describe in
the paper have already been added to C, in the form of C++.

--
Ian Collins.
Apr 18 '07 #4
Ian Collins wrote:
Laurent Deniau wrote:
>I just put the draft of my paper on the web:

http://cern.ch/laurent.deniau/html/c...la07-draft.pdf

I would be interested by any feedback from C programmers (with
little OO knowledge) to improve the paper quality, even if I don't
know yet if the paper will be accepted. It is not intended to be a
manual nor an introduction to OOP. Just to mention it (not in the
paper), my programming background is 10+ years of C/C++.

Given your background, I have to ask why? The features you describe
in the paper have already been added to C, in the form of C++.
C++ is another language, and off-topic here.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews

--
Posted via a free Usenet account from http://www.teranews.com

Apr 19 '07 #5
jacob navia wrote:
>
.... snip ...
>
1) lcc-win32 implements try/catch exception handling in
a slightly similar way than what you propose.
For instance

void fn(void)
{
char *p=NULL;
unsigned code;
__try {
*p = 0;
printf("No exceptions\n");
}
__except(code=G etExceptionCode (),EXCEPTION_EX ECUTE_HANDLER) {
printf("Ooops, there was a problem with this program.”);
printf("Error code: %#x\n",code);
}
return 0;
}
This has nothing to do with standard C, the subject of this
newsgroup.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews

--
Posted via a free Usenet account from http://www.teranews.com

Apr 19 '07 #6
CBFalconer wrote:
Ian Collins wrote:
>>Laurent Deniau wrote:

>>>I just put the draft of my paper on the web:

http://cern.ch/laurent.deniau/html/c...la07-draft.pdf

I would be interested by any feedback from C programmers (with
little OO knowledge) to improve the paper quality, even if I don't
know yet if the paper will be accepted. It is not intended to be a
manual nor an introduction to OOP. Just to mention it (not in the
paper), my programming background is 10+ years of C/C++.

Given your background, I have to ask why? The features you describe
in the paper have already been added to C, in the form of C++.

C++ is another language, and off-topic here.
So? I was asking the OP why he proposes to reinvent a wheel, not
discussing C++.

--
Ian Collins.
Apr 19 '07 #7
Ian Collins wrote:
CBFalconer wrote:
>Ian Collins wrote:
.... snip ...
>>>
Given your background, I have to ask why? The features you
describe in the paper have already been added to C, in the
form of C++.

C++ is another language, and off-topic here.

So? I was asking the OP why he proposes to reinvent a wheel,
not discussing C++.
Probably because he wants to use that language on a system that
doesn't sport a C++ compiler. I think you use what you can get.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews

--
Posted via a free Usenet account from http://www.teranews.com

Apr 19 '07 #8
Ian Collins wrote:
Laurent Deniau wrote:
>I just put the draft of my paper on the web:

http://cern.ch/laurent.deniau/html/c...la07-draft.pdf

I would be interested by any feedback from C programmers (with little OO
knowledge) to improve the paper quality, even if I don't know yet if the
paper will be accepted. It is not intended to be a manual nor an
introduction to OOP. Just to mention it (not in the paper), my
programming background is 10+ years of C/C++.
Given your background, I have to ask why? The features you describe in
the paper have already been added to C, in the form of C++.
<OT>
In fact, this is the usual answer I get when I am talking about OOP in
C. But the object model of COS has nothing to do with the one of C++.

COS is very close to CLOS from the point of view of the object model
with many similarities to ObjC due to the fact that it is built on top
of C. But it is very far from C++. As an example, one can look at the
GoF patterns and check for each one why it is needed. Most of them are
there to solve either a problem related to static typing and/or coupling
and/or dynamic behavior and/or missing meta-knowledge. As soon as you
jump on the dark side (i.e. dynamic typing, dynamic dispatch,
meta-classes), they become much less useful. Code and design become
simpler but more permissive.

My point of view is that all the paradigms (SI, MI, template, overload,
override, namespace) introduced by C++ provide (powerful) static glue
(coupling) except dynamic_cast which is not the heart of C++
programming. C++ can be very flexible with meta-programming which is the
modern approach of libraries design (i.e. STL, Boost). But this
flexibility exists only statically at the code level and often makes
unforeseen extension very difficult and/or complex to add. To achieve
flexibility and extensibility in C++ at the level of frameworks, one
need to think in term of roles and components (see ref 21 and 22 of the
paper). Pushing this reasoning to the limits (i.e. one method per role)
and the roles become generics. For a global approach to the problem but
specific to C++, one can read the book of John Lakos "Large-Scale C++
Software Design".

To conclude on C++, I knew that it would be a major concern for many C++
programmers. Earlier releases of the paper had a full section discussing
of pros and cons of main stream languages with a special attention for
C++ (with 14 references which are still in the latex version ;-) ). But
I had to suppress it, due to the limits of 18 pages. My believe is that
on one hand, programmers to who COS doesn't look attractive don't need
its features to solve the problems they encounter. On the other hand,
programmers to who COS does look attractive already faced the same
problems I had to solve and understand the motivation.
<OT>

Apr 19 '07 #9
CBFalconer wrote:
Ian Collins wrote:
>CBFalconer wrote:
>>Ian Collins wrote:
... snip ...
>>>Given your background, I have to ask why? The features you
describe in the paper have already been added to C, in the
form of C++.
C++ is another language, and off-topic here.
So? I was asking the OP why he proposes to reinvent a wheel,
not discussing C++.

Probably because he wants to use that language on a system that
doesn't sport a C++ compiler. I think you use what you can get.
I hope that people will not see COS as yet-another C++ since it has
nothing to do with C++ and it is not intended to replace it when it is
not available. If this is the conclusion of the paper readers, it would
mean that I completely failed to explain the interest of COS (sic!).

a+, ld.

Apr 19 '07 #10

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

Similar topics

15
2270
by: Ville Vainio | last post by:
Pythonic Nirvana - towards a true Object Oriented Environment ============================================================= IPython (by Francois Pinard) recently (next release - changes are still in CVS) got the basic abilities of a system shell (like bash). Actually, using it as a shell is rather comfortable. This all made me think... Why do we write simple scripts to do simple things? Why do we serialize data to flat text files in...
1
3220
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't understand is:
0
2670
by: monkey king | last post by:
I have a given dll file(PDFCreator.dll) - probably generated by VC++. I want to use its method(PDFCreator()) in dotNet environment. It works well in WindiowsApplication, but bad in WebApplication ,the line that calls the function results in the "Object reference not set to an instance of an object" error. The following is the VB.NET code I am using to define the structures, declare the unmanaged DLL function and call the unmanaged DLL...
11
9243
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
0
9769
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520" AutoPostBackOnNodeMove="false" DragAndDropEnabled="true" NodeEditingEnabled="False" KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode" HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
0
4626
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object class (Object.cs in rotor). What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't understand is:
3
3166
by: Poewood | last post by:
Okay here are four classes for a pocket pc program: Input, fpositional, ComboBoxArray and TextBoxArray. The "input" class is the form. I use the fpositional class to handle most of the functions for the objects on the form, in addition the The objects are created in the fpositional class and affixed to the Input form through the fpositional constructor which takes the form as an argument. The ComboBox and TextBox Array classes hold the...
4
2801
by: Kevin Phifer | last post by:
Ok, before anyone freaks out, I have a solution I need to create that gathers content from maybe different places. Each one can return a <form> in the html, so its the classic can't have more than one runat=server form on a asp.net page. However, I still want developers to be able to use asp.net controls to create some apps that are created on the page. So I need multiple forms on a asp.net page(doesn't everyone). I purchased the...
5
2260
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2 = "otherText" xmlSave("C:\folder\file.xml", mySettings) Here is the sub: Public Shared Sub xmlSave(ByVal path As String, ByVal config As
8
2465
by: ST | last post by:
Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!! This is the error: biopsy.searchsubject.btnSubject_Click(Object Sender, EventArgs e) in C:\INetPub\WWWRoot\biopsy\searchsubject.aspx.vb:198 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
0
8323
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8613
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
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 we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.