Topic: Daft Idea? operator->=
Author: maxtal@physics.su.OZ.AU (John Max Skaller)
Date: Thu, 8 Dec 1994 14:38:05 GMT Raw View
In article <1994Nov27.232715.17437@leeds.ac.uk> sp106@ebor.york.ac.uk (Stephen Parker) writes:
>John Max Skaller (maxtal@physics.su.OZ.AU) wrote:
>: In article <1994Nov23.185041.4929@leeds.ac.uk> sp106@ebor.york.ac.uk (Stephen Parker) writes:
>: >There I was chasing a linked list with, p = p-> next, and then I
>: >thought: Why isn't there a p->=next operator? Has this been considered?
>: >And if not why not? Is it considered to be too complicated? It seems
>: >no worse than >>= say.
>
>: template<class T> T* chase(T*&p) { return p=p->next; }
>: ...
>: for(X *p=c.begin(); p!=c.end(); chase(p)) { ..}
>
>And if the object pointed to did not have a `next' member, but a
>`next_link' member? This is not very useful.
>I am quite aware of
>the mechanics of pointer usage, I merely wished to test the water on
>why we accept op= operators but not for all op's. I take it you
>don't consider the idea of the language being more homogeneous to
>be particulaly important?
Actually I do. But it would be more useful to allow
t . mem to mean &(t->mem);
ptm . ptm2 (add ptm to another to get ptm to nested member)
the latter of which cannot be done _at all_ in C++. And it would be
useful to have an exponent operator -- and half a dozen other
things too.
>I would prefer op= to be defined for
>all operators for which it isn't ludicrous, or defined for none. Half
>measures complicate unnecessarily.
The committee has to chose carefully which extensions
to accept. It takes time to consider them. I agree with you
in principle.
Write a formal proposal. Too much effort? Exactly.
Partial specialisations are more interesting, more useful,
and more necessary.
--
JOHN (MAX) SKALLER, INTERNET:maxtal@suphys.physics.su.oz.au
Maxtal Pty Ltd,
81A Glebe Point Rd, GLEBE Mem: SA IT/9/22,SC22/WG21
NSW 2037, AUSTRALIA Phone: 61-2-566-2189
Author: maxtal@physics.su.OZ.AU (John Max Skaller)
Date: Sat, 26 Nov 1994 06:58:57 GMT Raw View
In article <1994Nov23.185041.4929@leeds.ac.uk> sp106@ebor.york.ac.uk (Stephen Parker) writes:
>There I was chasing a linked list with, p = p-> next, and then I
>thought: Why isn't there a p->=next operator? Has this been considered?
>And if not why not? Is it considered to be too complicated? It seems
>no worse than >>= say.
template<class T> T* chase(T*&p) { return p=p->next; }
...
for(X *p=c.begin(); p!=c.end(); chase(p)) { ..}
--
JOHN (MAX) SKALLER, INTERNET:maxtal@suphys.physics.su.oz.au
Maxtal Pty Ltd,
81A Glebe Point Rd, GLEBE Mem: SA IT/9/22,SC22/WG21
NSW 2037, AUSTRALIA Phone: 61-2-566-2189
Author: tohoyn@janus.otol.fi (Tommi H|yn{l{nmaa)
Date: 26 Nov 1994 08:46:21 GMT Raw View
Stephen Parker (sp106@ebor.york.ac.uk) wrote:
: There I was chasing a linked list with, p = p-> next, and then I
: thought: Why isn't there a p->=next operator? Has this been considered?
: And if not why not? Is it considered to be too complicated? It seems
: no worse than >>= say.
If linked list is implemented as a class there are much better ways to
iterate through it. Naturally, the implementation of the linked list
needs something like 'p = p->next', but I don't think operator ->= is
needed in the language.
Tommi H|yn{l{nmaa
Author: sp106@ebor.york.ac.uk (Stephen Parker)
Date: Sun, 27 Nov 1994 23:27:14 +0000 (GMT) Raw View
John Max Skaller (maxtal@physics.su.OZ.AU) wrote:
: In article <1994Nov23.185041.4929@leeds.ac.uk> sp106@ebor.york.ac.uk (Stephen Parker) writes:
: >There I was chasing a linked list with, p = p-> next, and then I
: >thought: Why isn't there a p->=next operator? Has this been considered?
: >And if not why not? Is it considered to be too complicated? It seems
: >no worse than >>= say.
: template<class T> T* chase(T*&p) { return p=p->next; }
: ...
: for(X *p=c.begin(); p!=c.end(); chase(p)) { ..}
And if the object pointed to did not have a `next' member, but a
`next_link' member? This is not very useful. I am quite aware of
the mechanics of pointer usage, I merely wished to test the water on
why we accept op= operators but not for all op's. I take it you
don't consider the idea of the language being more homogeneous to
be particulaly important? I would prefer op= to be defined for
all operators for which it isn't ludicrous, or defined for none. Half
measures complicate unnecessarily.
Anyhow,
Stephen
Author: sp106@ebor.york.ac.uk (Stephen Parker)
Date: Sun, 27 Nov 1994 23:28:48 +0000 (GMT) Raw View
Tommi H|yn{l{nmaa (tohoyn@janus.otol.fi) wrote:
: Stephen Parker (sp106@ebor.york.ac.uk) wrote:
: : There I was chasing a linked list with, p = p-> next, and then I
: : thought: Why isn't there a p->=next operator? Has this been considered?
: : And if not why not? Is it considered to be too complicated? It seems
: : no worse than >>= say.
: If linked list is implemented as a class there are much better ways to
: iterate through it. Naturally, the implementation of the linked list
: needs something like 'p = p->next', but I don't think operator ->= is
: needed in the language.
It is not _needed_ but why is it necessary to consider if it is needed
when op= is defined for most other operations, surely it could be
argued purely on the grounds of orthogonality.
Anyhow,
Stephen
Author: sp106@ebor.york.ac.uk (Stephen Parker)
Date: Wed, 23 Nov 1994 18:50:41 +0000 (GMT) Raw View
There I was chasing a linked list with, p = p-> next, and then I
thought: Why isn't there a p->=next operator? Has this been considered?
And if not why not? Is it considered to be too complicated? It seems
no worse than >>= say.
Anyhow,
Stephen.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ i really don't know what i'm doing here ~~~~~~~~~~~~~~~~~~~~~~
~ i really think i should've gone to bed tonight ~ SP106@UK.AC.YORK ~
~ but... just one drink ~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~