Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-08-07 10:37:59


Jens Maurer wrote:
>
> John Max Skaller wrote:
> >
> > Jens Maurer wrote:
> > >
> > > John Max Skaller wrote:
> > > > I seek your opinion on get/set vs. get/ref.
>
> > Here's the problem. Consider:
>
> > struct X { a: int; };
> > var x : X;
> > x.a = 1;
>
> [Helpful explanation skipped.]
>
> > The compiler has to know '&x.a' and translate it.
> > But using set methods, it has to know 'x.a='.
>
> Sure: Since your primary syntax doesn't easily distinguish
> between reading and writing, the compiler has to do it
> if it wishes to use an interface which does (i.e. get/set).

        Ah. I hadn't thought of it that way.
What you're saying is that to use get/set properly,
I can't just treat assignment as a procedure call

        set(&lhs,rhs)

which appears to use reference semantics anyhow: lhs has
to be an 'lvalue' to be addressable.

-- 
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