Article View: comp.lang.oberon
Article #1334Type-bound operators
From: Hamish Lawson
Date: Mon, 15 Apr 1996 14:33
Date: Mon, 15 Apr 1996 14:33
31 lines
1556 bytes
1556 bytes
jneuhof@ibm.net wrote: > What is missing in Oberon-2 is something like type-bound operators, > implemented similar to type-bound procedures. > > E.g.: > > PROCEDURE( COMPLEX ) "+" > ( VAR RVal1 : COMPLEX; > VAR RVal2 : COMPLEX > ) : COMPLEX; > BEGIN > .... > END "+"; Leaving aside the other points which have been raised by others concerning type-bound operators, I thought I would mention just one small point. Would the expression c1 + c2 not be regarded as c1 invoking its "+" method with an argument of c2 (in other words, c1 + c2 is a syntactic convenience for c1.plus(c2))? This would give us the following definition for the operator. PROCEDURE (VAR RVal1 : COMPLEX) "+" (VAR RVal2 : COMPLEX) : COMPLEX; BEGIN .... END "+"; | Hamish Lawson, School of Computing and Mathematics, | University of Teesside, Middlesbrough, Cleveland, UK, TS1 3BA | Tel: +44 1642 212695 Fax: +44 1642 342604 | E-mail: H.Lawson@tees.ac.uk
Technical Details
Message-ID:
<31725E6F.3980@tees.ac.uk>Path:
arc1-ca.pugleaf.net!leeds.ac.uk!newsReferences:
<danforth.828397346@Turing.Stanford.EDU> <4js4dk$f7v@ra.nrl.navy.mil> <225BC72BH00088B82H@p.froehlich.amc.cube.net> <4kh4q3$vtu@news-s01.ny.us.ibm.net>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.oberon Path: arc1-ca.pugleaf.net!leeds.ac.uk!news From: H.Lawson@tees.ac.uk (Hamish Lawson) Subject: Type-bound operators Message-ID: <31725E6F.3980@tees.ac.uk> X-Mailer: Mozilla 2.01Gold (Win95; I) Content-Type: text/plain; charset=us-ascii Organization: University of Teesside, School of Computing and Maths MIME-Version: 1.0 Date: Mon, 15 Apr 1996 15:33:16 +0100 (BST) References: <danforth.828397346@Turing.Stanford.EDU> <4js4dk$f7v@ra.nrl.navy.mil> <225BC72BH00088B82H@p.froehlich.amc.cube.net> <4kh4q3$vtu@news-s01.ny.us.ibm.net> Content-Transfer-Encoding: 7bit