[OT] What should be in a programming language?

Yigal Chripun yigal100 at gmail.com
Mon Oct 26 14:06:33 PDT 2009


On 26/10/2009 14:47, Kagamin wrote:
> Yigal Chripun Wrote:
>
>> for instance there's special handling of void return types so it would
>> be easier to work with in generic code. instead of this compiler hack a
>> much simpler solution is to have a unit type and ditch C style void. the
>> bottom type should also exist mainly for completeness and for a few
>> stdlib functions like abort() and exit()
>
> uint and void return types may be nearly equivalent for x86 architecture, CLI makes strong difference between them.

I have no idea what uint has to do with what I said.
in type theory, a unit type contains only one value, and a bottom type 
contains zero values.
the single value of unit can be for example an empty tuple.

a function like abort doesn't return anything at all so it's return type 
is the bottom type.

In ML all functions have exactly one tuple argument and one tuple return 
type.
so, for example this c function:
void foo();
would have the following signature in ML:
unit -> unit
if we have:
void foo();
void bar();

foo(bar()); is perfectly legal with ML semantics since both functions 
have the signature: unit -> unit



More information about the Digitalmars-d mailing list