On Fri, 2006-09-01 at 22:49 -0700, Erick Tryzelaar wrote:
> skaller wrote:

> This leads me to some of the stuff I was thinking we could do with the 
> language. Here's a couple of my ideas:
> 
> 
> 1. make the bit-ints the builtin, and tiny,short,etc the alias
> 
> I know that int8, int16, and etc are a recent addition to the language, 
> but I feel they should have been in there in the beginning, and char, 
> short, and etc should have been typedefs to the more exact name 

This is not possible unfortunately. I agree with the sentiment BUT:
Felix must support C++ overloading. Overloading in C++ is based
on the fast_int (short, int etc) types, NOT the exact_int types.

If we may fast ints aliases for exact ints, every existing platform
would break, because all of them provide at least one pair of 
distinct types of the same length.

Furthermore, for ISO C99 compatibility, the aliases from the
exact ints to the fast ints can lead to an ambiguity, and we
must resolve that to the system provided alias, if there is one.

For example if long and long long are both 64 bits, the definition
of int64 in Felix must map to whichever of these int64_t maps to,
assuming int64_t exists. We're only free to choose the mapping
if ISO C99 int64_t is not defined.

On the other hand: if you write your code exclusively using
exact ints, the C++ is guaranteed to overload correctly,
since the mapping must be injective, AND compatible with C99.

Note similar arguments apply to size, ptrdiff, intptr, maxint.

The problem is that the current system isn't workable,
since unlike C and C++ we have

(a) no automatic conversions
(b) no mixed mode arithmetic

together with

(c) A requirement to provide C/C++ compatibility
    so at least primitive bindings can work

(d) A requirement to work in the abstract with
    deterministic encodings (as evidenced by your
    comment)

I don't see any way to satisfy all these criteria at once.

Since originally making ALL these types abstract, I have
changed the model because the only way the fully abstracted
system can work, when you're trying to bind a C library,
is to write a LOT of casts, left right and centre, which
makes the code unreadable .. and isn't any more deterministic
or functional than if the conversions were implicit (because
there are just too damn many of them).

FYI: if you think this is hard .. thing about

C++ complex<> template vs. C99 _Complex data type.. :)

FYI2: what about pointers (const, volatile blah blah)

FYI3: Felix is *intended* to model any solution to these
problems we care to devise, primarily using the library
rather than builtin compiler support. This is why some
half finished hacks like the 'constrained polymorphism'
system is implemented. It is enough to solve some modelling
problems, even though it isn't properly generalised.



-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to