Re: Grammars for future languages

macrakis@osf.org (Stavros Macrakis)
Mon, 13 Nov 1995 22:29:10 GMT

          From comp.compilers

Related articles
[10 earlier articles]
Re: Grammars for future languages mbbad@s-crim1.daresbury.ac.uk (1995-11-08)
Re: Grammars for future languages szilagyi@szilagyi.mit.edu (1995-11-09)
Re: Grammars for future languages davids@ICSI.Berkeley.EDU (1995-11-10)
Re: Grammars for future languages macrakis@osf.org (1995-11-10)
Re: Grammars for future languages mfinney@inmind.com (1995-11-12)
Re: Grammars for future languages RWARD@math.otago.ac.nz (Roy Ward) (1995-11-13)
Re: Grammars for future languages macrakis@osf.org (1995-11-13)
Re: Grammars for future languages rekers@wi.leidenuniv.nl (1995-11-14)
Re: Grammars for future languages egouriou@CS.UCLA.EDU (Eric Gouriou) (1995-11-16)
Re: Grammars for future languages sethml@dice.ugcs.caltech.edu (1995-11-21)
| List of all articles for this month |
Newsgroups: comp.compilers
From: macrakis@osf.org (Stavros Macrakis)
Keywords: syntax, design
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
      assignment `:='...


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
good idea:


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,
      locking, etc.


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


-s
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.