|[10 earlier articles]|
|Re: Grammars for future languages firstname.lastname@example.org (1995-11-08)|
|Re: Grammars for future languages email@example.com (1995-11-09)|
|Re: Grammars for future languages davids@ICSI.Berkeley.EDU (1995-11-10)|
|Re: Grammars for future languages firstname.lastname@example.org (1995-11-10)|
|Re: Grammars for future languages email@example.com (1995-11-12)|
|Re: Grammars for future languages RWARD@math.otago.ac.nz (Roy Ward) (1995-11-13)|
|Re: Grammars for future languages firstname.lastname@example.org (1995-11-13)|
|Re: Grammars for future languages email@example.com (1995-11-14)|
|Re: Grammars for future languages egouriou@CS.UCLA.EDU (Eric Gouriou) (1995-11-16)|
|Re: Grammars for future languages firstname.lastname@example.org (1995-11-21)|
|From:||email@example.com (Stavros Macrakis)|
|Organization:||OSF Research Institute|
|References:||95-10-103 95-10-140 95-11-048 95-11-094|
|Date:||Mon, 13 Nov 1995 22:29:10 GMT|
davids@ICSI.Berkeley.EDU (David Petrie Stoutamire) writes:
...[in Sather,] there deliberately isn't any way to redefine
There is a good argument to be made that assignment should be
overloadable. Here are a few of the standard examples where it's a
1) A variable-length vector type may have a large fixed allocation,
but only some small part may be meaningful at any time. A
redefined assignment operator can copy only the active part.
2) If an object is represented as a linked structure (e.g. a sparse
matrix), there is no predefined operation that will copy the right
things. Copying the top-level pointer/reference means that
semantics will be different from a dense matrix where assignment is
value copy, not reference copy.
3) An object which is resident across a network can have an assignment
operator that does appropriately clever things with caching,
4) Debugging: you might want an indication whenever a given object is
modified. Of course, this really should be at the _object_, not
the _type_ level.
None of this is particularly exotic or contrived. There _are_ some
more exotic applications, though....
It is certainly possible to create bizarre and pathological situations
with an overloaded assignment operator, but then that is true of
almost all language mechanisms....
Return to the
Search the comp.compilers archives again.