A Pointless Library Proposal

Ashley Yakeley ashley at semantic.org
Mon Oct 23 22:50:30 EDT 2006


Philippa Cowderoy wrote:
> On Mon, 23 Oct 2006, Samuel Bronson wrote:
> 
>> On 23 Oct 2006 22:05:58 -0400, kahl at cas.mcmaster.ca
>> <kahl at cas.mcmaster.ca> wrote:
>>
>>> I'd say that ``Void'' is not a desirable candidate
>>> since too many people know C,
>>> and the C type ``void'' corresponds to ``()'' (or ``IO ()''...)
>> So how come whenever I say that, someone invariably corrects me that
>> C's void type is uninhabited, whereas the () type is inhabited by ()?
>> And that a real void-alike wouldn't have any constructors?
>>
> 
> Because C's an impure language - and thus it's possible to do something 
> meaningful without returning a value. Oh, and because they're right.

No, I think Wolfram's correct.

In C, void represents a return structure of zero bytes. It therefore has 
256^0 = 1 value, just like the "()" type (ignoring bottom).

AFAIR C disallows declaring a variable void, though it would be 
theoretically possible to relax this, and have them allocated as zero 
bytes. Reading a variable of type "void" would return the "void value" 
without actually reading from memory (since zero of it is allocated to 
read from), and assigning to it would do nothing.

-- 
Ashley Yakeley




More information about the Libraries mailing list