Message from discussion
Confused by augment and inner
Received: by 10.224.189.75 with SMTP id dd11mr9460221qab.6.1348468573808;
Sun, 23 Sep 2012 23:36:13 -0700 (PDT)
X-BeenThere: racket-users@googlegroups.com
Received: by 10.224.217.65 with SMTP id hl1ls10646074qab.8.gmail; Sun, 23 Sep
2012 23:36:13 -0700 (PDT)
Received: by 10.224.220.12 with SMTP id hw12mr9470357qab.8.1348468573735;
Sun, 23 Sep 2012 23:36:13 -0700 (PDT)
Received: by 10.224.220.12 with SMTP id hw12mr9470356qab.8.1348468573724;
Sun, 23 Sep 2012 23:36:13 -0700 (PDT)
Return-Path: <users-boun...@racket-lang.org>
Received: from champlain.ccs.neu.edu (champlain.ccs.neu.edu. [129.10.115.116])
by gmr-mx.google.com with ESMTPS id g28si4728161qcq.2.2012.09.23.23.36.13
(version=TLSv1/SSLv3 cipher=OTHER);
Sun, 23 Sep 2012 23:36:13 -0700 (PDT)
Received-SPF: neutral (google.com: 129.10.115.116 is neither permitted nor denied by domain of users-boun...@racket-lang.org) client-ip=129.10.115.116;
Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 129.10.115.116 is neither permitted nor denied by domain of users-boun...@racket-lang.org) smtp.mail=users-boun...@racket-lang.org
Received: from champlain.ccs.neu.edu (localhost.localdomain [127.0.0.1])
by champlain.ccs.neu.edu (8.14.4/8.14.4) with ESMTP id q8O6Vwbj014352;
Mon, 24 Sep 2012 02:34:45 -0400
Received: from mail-ob0-f174.google.com (mail-ob0-f174.google.com
[209.85.214.174])
by champlain.ccs.neu.edu (8.14.4/8.14.4) with ESMTP id q8O6VqAx014345
for <us...@lists.racket-lang.org>; Mon, 24 Sep 2012 02:31:52 -0400
Received: by obbuo13 with SMTP id uo13so5026539obb.33
for <us...@lists.racket-lang.org>; Sun, 23 Sep 2012 23:31:52 -0700 (PDT)
d=google.com; s=20120113;
h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf
:mime-version:content-type:x-proofpoint-virus-version
:x-proofpoint-spam-details:from:subject:message-id:date:to:x-mailer
:x-gm-message-state;
bh=38Hplpx/NnoHdI8ifDWLcOQtwF1s+TzuKzi4qWVuS50=;
b=nAOZon8BrQQ/DFXsxOSp3V8DU8ulS+9p0LYbidz5k++q3tdyCft8XIPT0ZfVqVuXlC
ysN2plHHXAWkZ2VWItZ+FsAHF2nv39cPhjhipNbiJs91FFir0GBmZPBN7kUKanTNle29
lCzXevytLP1GFgoW2FUWDikuUAVul3kDhdhi9Psi9zI36+gaRdvlnld/gzLKppC3j3qN
avjANRf93ivoFuXfmvAbrq5PpoidSAUOZTTI8jmh60mHfqRjs0DrFZ1twgK98GLqb2VA
krIOcpD6ee8QlV4MRFWhTuUOUPb/tIkdVpf2PbnlysBSW+Gr2kpDg5D+EFr2hnIn53Oa
k6EA==
Received: by 10.60.26.133 with SMTP id l5mr9297441oeg.60.1348468312466;
Sun, 23 Sep 2012 23:31:52 -0700 (PDT)
X-Forwarded-To: us...@lists.racket-lang.org
X-Forwarded-For: us...@plt-scheme.org us...@lists.racket-lang.org
Delivered-To: us...@racket-lang.org
Received: by 10.76.13.162 with SMTP id i2csp201951oac;
Sun, 23 Sep 2012 23:31:51 -0700 (PDT)
Received: by 10.236.181.225 with SMTP id l61mr10832126yhm.47.1348468311665;
Sun, 23 Sep 2012 23:31:51 -0700 (PDT)
Received: from st11p01mm-asmtp001.mac.com (st11p01mm-asmtp001.mac.com.
[17.172.204.236])
by mx.google.com with ESMTP id k67si14966218yhj.58.2012.09.23.23.31.51;
Sun, 23 Sep 2012 23:31:51 -0700 (PDT)
Received-SPF: pass (google.com: domain of gregwoodho...@me.com designates
17.172.204.236 as permitted sender) client-ip=17.172.204.236;
MIME-version: 1.0
Received: from [10.0.0.105]
(adsl-75-18-208-69.dsl.pltn13.sbcglobal.net [75.18.208.69])
by st11p01mm-asmtp001.mac.com
(Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit
(built Jan
3 2012)) with ESMTPSA id <0MAU00BTSCT15...@st11p01mm-asmtp001.mac.com>
for us...@racket-lang.org; Mon, 24 Sep 2012 06:31:51 +0000 (GMT)
X-Proofpoint-Virus-Version: vendor=fsecure
engine=2.50.10432:5.7.7855,1.0.431,0.0.0000
definitions=2012-09-24_02:2012-09-21, 2012-09-24,
1970-01-01 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
ipscore=0 suspectscore=3 phishscore=0 bulkscore=0 adultscore=0
classifier=spam
adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001
definitions=main-1209230462
From: Gregory Woodhouse <gregwoodho...@me.com>
Message-id: <3B12168F-A5D1-401A-ADB0-0DA0211B5...@me.com>
Date: Sun, 23 Sep 2012 23:31:48 -0700
To: Racket Mailing List <us...@racket-lang.org>
X-Mailer: Apple Mail (2.1498)
X-Gm-Message-State: ALoCoQkq+uos8kj2AITM9mSwvMC3WFteno1D+s4kqIP4v4v6raKlB3m0EHW6Q7k3TuL82Dd6jDHN
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,HTML_MESSAGE,
RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
champlain.ccs.neu.edu
Subject: [racket] Confused by augment and inner
X-BeenThere: us...@racket-lang.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Racket Users <users.racket-lang.org>
List-Unsubscribe: <http://lists.racket-lang.org/users/options>,
<mailto:users-requ...@racket-lang.org?subject=unsubscribe>
List-Archive: <http://lists.racket-lang.org/users/archive/>
List-Post: <mailto:us...@racket-lang.org>
List-Help: <mailto:users-requ...@racket-lang.org?subject=help>
List-Subscribe: <http://lists.racket-lang.org/users/listinfo>,
<mailto:users-requ...@racket-lang.org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============0904167011=="
Sender: users-boun...@racket-lang.org
Errors-To: users-boun...@racket-lang.org
--===============0904167011==
Content-type: multipart/alternative;
boundary="Boundary_(ID_Rj2ON1qN9uHGHUIN7cdPMg)"
--Boundary_(ID_Rj2ON1qN9uHGHUIN7cdPMg)
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
I am trying to understand how augmentable methods (as described in section 13.5 of The Guide) work.
Between the extremes of allowing arbitrary overriding and disallowing overriding entirely, the class system also supports Beta-style augmentable methods [Goldberg04]. A method declared with pubment is like public, but the method cannot be overridden in subclasses; it can be augmented only. A pubment method must explicitly invoke an augmentation (if any) using inner; a subclass augments the method using augment, instead of override.
From this I conclude that if, for example, I have a class a% and a subclass b% and I want to augment a method of a% in b% I need to call inner in the definition of the method in a%, not b%. Something like this
#lang racket
(define a%
(class object%
(super-new)
(define/pubment (hello)
(printf "Hello~n")
(inner 0))))
(define b%
(class a%
(super-new)
(define/augment (hello)
;Call super here?
(printf ", world!~n"))))
but this gives me an error (not really a surprise). My assumption is that super should be used in the subclass when overriding a method, but if a method is to be augmented any potential code in an augmenting class should be invoked from the superclass and super is not used in the subclass. Obviously, I'm missing something.
--Boundary_(ID_Rj2ON1qN9uHGHUIN7cdPMg)
Content-type: text/html; CHARSET=US-ASCII
Content-transfer-encoding: quoted-printable
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I am =
trying to understand how augmentable methods (as described in section =
13.5 of The Guide) work.<div><br></div><div><span style=3D"font-family: =
serif; text-align: left; background-color: rgb(255, 255, 255); ">Between =
the extremes of allowing arbitrary overriding and disallowing overriding =
entirely, the class system also supports Beta-style </span><span =
style=3D"font-family: serif; text-align: left; background-color: =
rgb(255, 255, 255); font-style: italic; ">augmentable</span><span =
style=3D"font-family: serif; text-align: left; background-color: =
rgb(255, 255, 255); "> methods [</span><a =
href=3D"file:///Applications/Racket%20v5.3/doc/guide/doc-bibliography.html=
#(cite._.Goldberg04)" pltdoc=3D"x" style=3D"font-family: serif; =
text-align: left; background-color: rgb(255, 255, 255); =
">Goldberg04</a><span style=3D"font-family: serif; text-align: left; =
background-color: rgb(255, 255, 255); ">]. A method declared =
with </span><span class=3D"RktSym" style=3D"font-family: monospace; =
color: rgb(38, 38, 128); text-align: left; background-color: rgb(255, =
255, 255); "><a =
href=3D"file:///Applications/Racket%20v5.3/doc/reference/createclass.html#=
(form._((lib._racket/private/class-internal..rkt)._pubment))" =
class=3D"RktStxLink" pltdoc=3D"x" style=3D"text-decoration: none; color: =
black; ">pubment</a></span><span style=3D"font-family: serif; =
text-align: left; background-color: rgb(255, 255, 255); "> is =
like </span><span class=3D"RktSym" style=3D"font-family: monospace; =
color: rgb(38, 38, 128); text-align: left; background-color: rgb(255, =
255, 255); "><a =
href=3D"file:///Applications/Racket%20v5.3/doc/reference/createclass.html#=
(form._((lib._racket/private/class-internal..rkt)._public))" =
class=3D"RktStxLink" pltdoc=3D"x" style=3D"text-decoration: none; color: =
black; ">public</a></span><span style=3D"font-family: serif; text-align: =
left; background-color: rgb(255, 255, 255); ">, but the method cannot be =
overridden in subclasses; it can be augmented only. A </span><span =
class=3D"RktSym" style=3D"font-family: monospace; color: rgb(38, 38, =
128); text-align: left; background-color: rgb(255, 255, 255); "><a =
href=3D"file:///Applications/Racket%20v5.3/doc/reference/createclass.html#=
(form._((lib._racket/private/class-internal..rkt)._pubment))" =
class=3D"RktStxLink" pltdoc=3D"x" style=3D"text-decoration: none; color: =
black; ">pubment</a></span><span style=3D"font-family: serif; =
text-align: left; background-color: rgb(255, 255, 255); "> method =
must explicitly invoke an augmentation (if any) using </span><span =
class=3D"RktSym" style=3D"font-family: monospace; color: rgb(38, 38, =
128); text-align: left; background-color: rgb(255, 255, 255); "><a =
href=3D"file:///Applications/Racket%20v5.3/doc/reference/createclass.html#=
(form._((lib._racket/private/class-internal..rkt)._inner))" =
class=3D"RktStxLink" pltdoc=3D"x" style=3D"text-decoration: none; color: =
black; ">inner</a></span><span style=3D"font-family: serif; text-align: =
left; background-color: rgb(255, 255, 255); ">; a subclass augments the =
method using </span><span class=3D"RktSym" style=3D"font-family: =
monospace; color: rgb(38, 38, 128); text-align: left; background-color: =
rgb(255, 255, 255); "><a =
href=3D"file:///Applications/Racket%20v5.3/doc/reference/createclass.html#=
(form._((lib._racket/private/class-internal..rkt)._augment))" =
class=3D"RktStxLink" pltdoc=3D"x" style=3D"text-decoration: none; color: =
black; ">augment</a></span><span style=3D"font-family: serif; =
text-align: left; background-color: rgb(255, 255, 255); ">, instead =
of </span><span class=3D"RktSym" style=3D"font-family: monospace; =
color: rgb(38, 38, 128); text-align: left; background-color: rgb(255, =
255, 255); "><a =
href=3D"file:///Applications/Racket%20v5.3/doc/reference/createclass.html#=
(form._((lib._racket/private/class-internal..rkt)._override))" =
class=3D"RktStxLink" pltdoc=3D"x" style=3D"text-decoration: none; color: =
black; ">override</a></span><span style=3D"font-family: serif; =
text-align: left; background-color: rgb(255, 255, 255); =
">.</span><br><div><br></div><div><br></div><div>=46rom this I conclude =
that if, for example, I have a class a% and a subclass b% and I want to =
augment a method of a% in b% I need to call inner in the definition of =
the method in a%, not b%. Something like =
this</div></div><div><br></div><div><div>#lang =
racket</div><div><br></div><div>(define a%</div><div> (class =
object%</div><div> (super-new)</div><div> =
(define/pubment (hello)</div><div> (printf =
"Hello~n")</div><div> (inner =
0))))</div><div><br></div><div>(define b%</div><div> (class =
a%</div><div> (super-new)</div><div> =
(define/augment (hello)</div><div> ;Call super =
here?</div><div> (printf ", =
world!~n"))))</div></div><div><br></div><div><br></div><div>but this =
gives me an error (not really a surprise). My assumption is that super =
should be used in the subclass when overriding a method, but if a method =
is to be augmented any potential code in an augmenting class should be =
invoked from the superclass and super is not used in the subclass. =
Obviously, I'm missing something.</div></body></html>=
--Boundary_(ID_Rj2ON1qN9uHGHUIN7cdPMg)--
--===============0904167011==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
____________________
Racket Users list:
http://lists.racket-lang.org/users
--===============0904167011==--