How to create a new capability by adding a prototype inheritance like javascripts for CLASSES language

37 views
Skip to first unread message

Tung Thanh Le

unread,
Dec 11, 2014, 6:10:17 PM12/11/14
to eo...@googlegroups.com
Hi all, 
   I am a newbie in scheme language, I am dealing with a problem that how to create a new capability for Classes language. I came up with my design as follows.

Expression::= extendx Identifier 
                                         {field Identifier}* 
                                         {method Identifier ({Identifier}*(,)) expression}

This "extendx" will inherit all properties from an object. For example,

class c1 extends object
   field x
   method m1 () 1
let o1 = new c1()
let o2 = extendx o1
    field f1= 10
    method m1 () 2
in list(send o2 f1, send o2 m1())

This is like a prototypal inheritance in js.
how can I modify to make it work? since I still not figure out how to do. Thanks. 

 

Reply all
Reply to author
Forward
0 new messages