Gregogy has made a post about rebol and javascript here http://blog.revolucent.net/2009/05/javascript-rebol.html
But as I'm going deeper into comparing javascript and rebol, I can't see what's the equivalent of rebol for javascript prototype. Because extending an object instance from another one with make in rebol isn't exactly like javascript prototype property as js prototype allows to extend ALL instances at once.
So am I mistaken or is there an equivalent of the code below for rebol:
<html>
<head>
</head>
<body>
<script>
function Person(firstName, lastName, sex) {
this.firstName = firstName;
this.lastName = lastName;
this.whoAreYou = function() {
alert( "I've been built with Constructor and my name is " + this.firstName + " " + this.lastName);
}
this.WhatIsYourSex = function() {
alert(this.sex);
}
};
Person.prototype.sex = "Man";
</script>
<script>
JaneDoe = new Person("Jane", "Doe");
JaneDoe.whoAreYou();
JaneDoe.WhatIsYourSex();
alert("Are you sure?");
JaneDoe.sex = "Woman";
JaneDoe.WhatIsYourSex();
</script>
</body>
</html>
Update: I don't care about syntactic sugar of course. Nothing prevents extension in R2 by just redefining an object. My question is not about extension of an object INSTANCE but about extension of ALL INSTANCES at once: that's what js prototype property allows.
So to reformulate my question: Can Rebol allow to also extend AUTOMATICALLY ALL INSTANCES of children by extending the parent class like javascript can whatever the syntax I don't care ?
For performance sure I see the difference between R2 and R3 for one instance but as for language functional feature I don't have automatic extension of all children objects which is a big burden as I'll have to manage them myself which will be quite slow since it's not done by the system itself. What if I want to create a framework like jquery which heavily relies on this kind of feature ? It would be a great hassle.