From owner-freebsd-current@FreeBSD.ORG Wed Nov 24 20:29:27 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9074F16A4CE for ; Wed, 24 Nov 2004 20:29:27 +0000 (GMT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C71843D3F for ; Wed, 24 Nov 2004 20:29:27 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin02-en2 [10.13.10.147]) by smtpout.mac.com (8.12.6/MantshX 2.0) with ESMTP id iAOKTROo008033; Wed, 24 Nov 2004 12:29:27 -0800 (PST) Received: from [10.1.1.245] (nfw2.codefab.com [199.103.21.225] (may be forged)) (authenticated bits=0)iAOKTPRp002935; Wed, 24 Nov 2004 12:29:26 -0800 (PST) In-Reply-To: <20041124184124.GA5166@funkthat.com> References: <200411231226.38172.jkim@niksun.com> <200411231343.22760.jhb@FreeBSD.org> <20041124002603.GD20881@squash.dsto.defence.gov.au> <41A416E7.4030107@mac.com> <20041124184124.GA5166@funkthat.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <88534D8A-3E57-11D9-BD47-003065ABFD92@mac.com> Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Wed, 24 Nov 2004 15:29:25 -0500 To: John-Mark Gurney X-Mailer: Apple Mail (2.619) cc: freebsd-current@freebsd.org Subject: Re: Transparent bridges (a. k. a. HUB-to-PCI bridges)? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2004 20:29:27 -0000 On Nov 24, 2004, at 1:41 PM, John-Mark Gurney wrote: >> True OOP involves encapsulation, polymorphism, and inheritence, and >> requires language support which is not really available in pure C. >> That >> being said, careful programming in C lets you create several >> closely-related structs for different types of "objects" which can >> all be >> utilized by a common set of functions. > > You should read up on KOBJ's which is how device_t's are implemented > in FreeBSD... kobj's are a loop more OOP that you think... OK. I've taken a look at sys/kobj.h and sys/kern/subr_kobj.c, is there something else I should read? My take on it, for what it is worth, is that KOBJs implement the class versus instance paradigm, have a dynamic runtime & method dispatch rather similar to the implementation of Objective-C or virtual C++ methods. Yes, this is a lot more object-oriented than what I said about being disciplined using C struct's. :-) Things that one still doesn't have is encapsulation in the sense of data hiding; what Java calls protected or private ivar's. Object memory management for instances via reference counting or GC would also be nice, although I even saw a hint of that in kobj_delete(), as well as a bit of the alloc/init & delete/free seperation. -- -Chuck