From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] useful language extension, or no? From: forsyth@vitanuova.com MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Tue, 16 Jul 2002 18:01:58 +0100 Topicbox-Message-UUID: cdd3a9dc-eaca-11e9-9e20-41e7f4b1d025 >>Why was it worthwhile to change the language in this respect, >>for the idiom of "always having to make sure the lock is the >>first item in the structure for pointer coersion is a pain?" because with ken's extension, it needn't be the first element, and it provides type checking that would be suppressed by the explicit cast required for the `first item' approach. in the case of Lock, it's easy to see that we could do without: typedef struct Thing Thing; struct Thing{ int a; Lock l; }; just requires lock(&t->l); instead of lock(t); as in Plan 9. the advantage of the latter, however, is that it is clear and readable, not that it saves typing. in fact it does save typing, but that's a side effect. it's also a little more subtle in the case of bio (say). in fact, C provides just what you want to save the ugly extra comparison: functions with early return. >>You're going to have to do better than that. Simply >>pulling the 'ole "I'm overly negative and as a result most >>people avoid confrontation with me" isn't going to cut it. overly negative? surely no one negative and pessimistic would bother to start thinking about writing a system, let alone actually doing it. surely doing something constructive is a truly positive act!