[e-lang] PBC example in documentation fails

Martin Scheffler wooyay at web.de
Tue Jan 2 13:04:33 CST 2007


Hi, how can I set an object to be PBC?

>From http://www.erights.org/elang/same-ref.html :

def makePoint(x, y) :any {
     return def point implements PassByCopy {
         to getX() :any { return x }
         to getY() :any { return y }
         to openState() :any {
             return meta.getState()
         }
         to openSource() :any {
             return meta.context().getOptSource()
         }
         to __printOn(out) :void {
             out.print(`<$x, $y>`)
         }
     }
 }

# value: <makePoint>

?  makePoint(2,3)
# problem: <AuditFailedException: object expression e`def point implements PassByCopy {

             method getX() :any {
                 escape __return {
                     __return.run(x)
                     null
                 }
             }

             method getY() :any {
                 escape __return {
                     __return.run(y)
                     null
                 }
             }

             method openState() :any {
                 escape __return {
                     __return.run(meta.getState())
                     null
                 }
             }

             method openSource() :any {
                 escape __return {
                     __return.run(meta.context().getOptSource())
                     null
                 }
             }

             method __printOn(out) :void {
                 escape __return {
                     out.print(simple__quasiParser.valueMaker("<${0}, ${1}>").su
bstitute(__makeList.run(x, y)))
                     null
                 }
             }
         }` failed audit by PassByCopy>
#
#   - __main$makePoint#run/2: <-.e#:span::1:13::1:13>
#   . <makePoint>(2, 3)
#   @ run/2: <-.e#:span::16:10::16:10>
#   - EExpr#evalToPair(Scope)
#   . e`makePoint.run(2, 3)`.evalToPair(<a Scope>)
#   @ evalToPair/1: <jar:file:/C:/Dokumente%20und%20Einstellungen/martin/Desktop
/workspace/E-purej-0.9.0a/e.jar!/org/erights/e/elang/cmd/cmdMakerMaker.emaker#:s
pan::124:57::124:66>

?






Note: I am using 0.9.0a
Thanks in advance
Martin





_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066



More information about the e-lang mailing list