Live data from Hacker News

New release of Self programming language

blog.selflanguage.org

1–10 of 40 posts

Re: New release of Self programming language

#4
post #3

Self (along with Scheme) was supposedly one of the big influences on Brendan Eich when he was creating JavaScript. Neat to know it's still out there.

Wonder how JS would have gone if it had fully embraced its prototypal nature instead of hiding it behind Java-like syntax. For as long as JS has been around, there were people clamoring for classes in the language, or thinking that it had classes, or implementing a class-like structure, until finally ES6.

But it didn't have to be that way. And now the sentiment is that OOP is bad, and inheritance is evil, and classes are the worse, forcing one to predefine a taxonomy that's likely to need refactoring.

But prototypal languages can be easily changed. Just change the parent slot(s), or modify the object itself, etc.

Re: New release of Self programming language

#5
Can we ever get away from the misnomer of "prototype-based OO"?

In Self we have two ways of specialization:

  1. Prototypes
  2. Parents
Prototypes are objects that are "cloned" to create instances, a very simple and direct notion of inheritance. We create an object (a "prototype") with properties that apply to a larger set of objects, and then for each instance we copy (clone) it and then add or modify properties as necessary for the instance. Self had optimizations to deal with this so instances did not end up being very fat.

Parents are objects that other objects "inherit from". At run-time property lookups are delegated to a parent. The difference between a parent and a prototype is that changes to the prototype do NOT affect the derived instances. Changes to a parent DO affect the derived instances.

So, when I read about "class-based" versus "prototype-based" languages, I cringe. It is really "class-based" versus "parent-based". How did cloning get confused with run-time delegation?

Self introduced the notion of self-describing instances. That is the essential coolness. The simplifying notion.

http://www.selflanguage.org/_static/published/self-power.pdf

Re: New release of Self programming language

#6
post #5

Can we ever get away from the misnomer of "prototype-based OO"? In Self we have two ways of specialization: 1. Prototypes 2. Parents Prototypes are objects that are "cloned" to create instances, a very simple and direct notion of inheritance. We create an object (a "prototype") with properties that apply to a larger set of objects, and then for each instance we copy (clone) it and then add or modify properties as nec…

And to make it even worse, Object.create does parent-relationship, and Object.assign does the cloning(if you squint a little bit). Which seems like it should be flip-flopped, since "create" is closer to "cloning" than "assign" is. Even the es5 improvements ended up getting it wrong!

Re: New release of Self programming language

#7
post #3

Self (along with Scheme) was supposedly one of the big influences on Brendan Eich when he was creating JavaScript. Neat to know it's still out there.

Wonder how JS would have gone if it had fully embraced its prototypal nature instead of hiding it behind Java-like syntax. For as long as JS has been around, there were people clamoring for classes in the language, or thinking that it had classes, or implementing a class-like structure, until finally ES6. But it didn't have to be that way. And now the sentiment is that OOP is bad, and inheritance is evil, and classes…

I wish JavaScript had been more like NewtonScript with Java influenced syntax instead of NS's Pascal-ish parts. Plus NewtonScript's frame and two parents was much nicer.

Re: New release of Self programming language

#8
post #5

Can we ever get away from the misnomer of "prototype-based OO"? In Self we have two ways of specialization: 1. Prototypes 2. Parents Prototypes are objects that are "cloned" to create instances, a very simple and direct notion of inheritance. We create an object (a "prototype") with properties that apply to a larger set of objects, and then for each instance we copy (clone) it and then add or modify properties as nec…

The paper you linked to does mention prototypes as Self's alternative to classes.

Edit: Oh I see. Cloning is the alternative to instantiation. Parent slots are the alternative to classical inheritance.

Re: New release of Self programming language

#9

Earlier quoted context omitted.

Wonder how JS would have gone if it had fully embraced its prototypal nature instead of hiding it behind Java-like syntax. For as long as JS has been around, there were people clamoring for classes in the language, or thinking that it had classes, or implementing a class-like structure, until finally ES6. But it didn't have to be that way. And now the sentiment is that OOP is bad, and inheritance is evil, and classes…

I wish JavaScript had been more like NewtonScript with Java influenced syntax instead of NS's Pascal-ish parts. Plus NewtonScript's frame and two parents was much nicer.

I wish IO or Self had been more successful, just to see how far one could push a pure prototyping language. IO is more flexible than JS, in that it has (almost) no syntax, just messages to objects, which means you can completely modify the syntax, making DSLs a natural fit for the language.

Re: New release of Self programming language

#10
post #3

Self (along with Scheme) was supposedly one of the big influences on Brendan Eich when he was creating JavaScript. Neat to know it's still out there.

Wonder how JS would have gone if it had fully embraced its prototypal nature instead of hiding it behind Java-like syntax. For as long as JS has been around, there were people clamoring for classes in the language, or thinking that it had classes, or implementing a class-like structure, until finally ES6. But it didn't have to be that way. And now the sentiment is that OOP is bad, and inheritance is evil, and classes…

[deleted]
Post reply on HN