Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-07-01 12:10:10


Peter Dimov wrote:
>

> > > This would probably be a step in the right direction, but the more
> important
> > > issue is how do you get from the function call expression
> > >
> > > f(x, y, z, 5)
> > >
> > > a tuple containing the arguments.
>
> [...]
>
> > See Felix. This is exactly what I do. It is also exactly
> > what SML does.
>
> I saw it. :-) I'm talking about C++. f(x, y, z, 5) is not compatible with
> f(t), where t = tuple(x, y, z, 5).

        I know that. The way to fix it is to get rid of all
functions of more than one argument. Obviously that requires
a language change, and then we're not talkng about C++ anymore.
In such a modified language, calls like

        f(1,2,3)

will still work as they do now. And so will declarations:

        void f(int,int,int);

Its just that you will be able to write:

        tuple<int,int,int> t = (1,2,3);
        f(t);

as well.

Except for operator comma, AFAIK this is a pure extension,
even though it completely changes the semantics of function
calling: all the old syntax still works. I believe that because
I've actually done it in Felix, but I could be wrong that it transfers
naturally to C++.

> In particular, f(x, y, z, 5) may pass everything in registers, or it may
> pass only x and 5 in registers.

        The same can happen with tuples: it is one reason
wby a compiler supported tuple is a good idea.

        By the way: if tuples are to be standardised
they should be made immutable. Mutable tuples
are too hard to optimise.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden] 
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix  http://felix.sourceforge.net
Literate Programming tool Interscript     
http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk