Re: Definable operators

Stefan Monnier <monnier+/news/comp/compilers@tequila.cs.yale.edu>
8 May 1997 21:03:00 -0400

          From comp.compilers

Related articles
[27 earlier articles]
Re: Definable operators burley@tweedledumb.cygnus.com (Craig Burley) (1997-04-30)
Re: Definable operators hrubin@stat.purdue.edu (1997-04-30)
Re: Definable operators apardon@rc4.vub.ac.be (1997-05-04)
Re: Definable operators Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-05-04)
Re: Definable operators ephram@ear.Psych.Berkeley.EDU (Ephram Cohen) (1997-05-06)
Re: Definable operators rideau@ens.fr (Francois-Rene Rideau) (1997-05-08)
Re: Definable operators monnier+/news/comp/compilers@tequila.cs.yale.edu (Stefan Monnier) (1997-05-08)
Re: Definable operators burley@tweedledumb.cygnus.com (Craig Burley) (1997-05-08)
Re: Definable operators burley@tweedledumb.cygnus.com (Craig Burley) (1997-05-08)
Re: Definable operators Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-05-12)
Re: Definable operators mfinney@lynchburg.net (1997-05-12)
Re: Definable operators burley@tweedledumb.cygnus.com (Craig Burley) (1997-05-13)
Re: Definable operators burley@tweedledumb.cygnus.com (Craig Burley) (1997-05-13)
[5 later articles]
| List of all articles for this month |
From: Stefan Monnier <monnier+/news/comp/compilers@tequila.cs.yale.edu>
Newsgroups: comp.compilers
Date: 8 May 1997 21:03:00 -0400
Organization: Compilers Central
References: 97-03-037 97-03-076 97-04-164 97-05-022
Keywords: syntax, design

apardon@rc4.vub.ac.be (Antoon Pardon) writes:
> Is it the responsibility of the language to enforce "+" is only used
> in appropiate ways or for that matter "insert"?


I think some kind of "enforcement" could be had by adding
constraints/assertions/invariants/younameit. The notion of "protocol"
which specifies about an object when some method can be called, could
be used or extended for that. One could add constraints (as part of
the language rather than merely comments) saying that all
redefinitions of function (or operator) toto should follow some
rules. This way you could enforce things like associativity. In a more
general setting, it simply allows to enforce a semantic similarity
between the different variants of some operation.


I believe this is exactly what Eiffel tries to do with its postconditions.




                Stefan
--


Post a followup to this message

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