matz / streem

prototype of stream based programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Will any OOP grammar be supported?

mySingleLive opened this issue · comments

There are already some functional syntax in the design of streem.
Will the "class", "method", "inheritance" or any other OOP elements be in this language?
I think "everything is an object" is good in ruby. Can I use the "Stream", "Pipleline" as an object in runtime?

No. I do not think that OOP is conducive to stream oriented programming. I'm not agains OOP in principle, in fact, I like Ruby, but in this context, OOP would feel slightly tacked-on and unwieldy. Objects, Methods, and Properties aren't suited to helping you think in a way that is based on filtering, mapping, transforming, and other stream oriented operations. That is why a more prototypal&functional approach might be better in this case. Prototypal is sort of a light wait version of OOP, so you could still program streem that way, and functional is inherently suited to list/stream based programs. (Just look at Lisp and Haskell).

ok, you mean that streem also is an object-based language(of course, Flow-based), it may use a light object model such as prototype , but not use the class-base model like in Java.
But I think class is needful. Prototype is not more efficient than class in most cases.
Certainly, that is my individual opinion. I'm not against Prototype :P

Maybe. But I think maybe that even Ruby's notion of classes might be a little unwieldy in this case. I was suggesting prototypal because I feel that it has all the advantages of classical, but with a little more of a lightweight, flexible feel to it. Also, classical OOP doesn't quite match up with the idea of a streem oriented language. Functional programming seems best, actually. But then again, OOP might be really cool in this case, with a few tweaks and new features! :D

Functional programming and OOP can play together nicely, you just have to be careful about state. From my experience with JavaScript, I feel like there's not much that you can do with classes that you can't do with prototypes. Also, when dealing with items in streams, the prototyping could come in handy.

Yeah... But maybe less weird/buggy syntax than js's for prototypes would do streem good.

Agreed. While I actually like how JavaScript does OOP with prototypes, the whole .prototype stuff can be pretty confusing at first. Maybe some sort of prototype syntax similar to Class < SuperClass or Python's Class(SuperClass) could work for Streem.

I like the Swift syntax for inheritance: Class: SuperClass. It looks less like your comparing classes or calling classes.

F# does OOP quite well for a functional language.

I like Haskell and OCaml's take on OOP. It's not quite OOP, but close enough to make OOP acolytes happy.

@dajoh Out of curiosity, do you have any examples you'd like to highlight? I haven't used F#.

Coffeescript replace the prototype with the “class” syntax.
It means that “class” is more practical. But prototype also can be used anywhere.

I really don't think this should be closed. We haven't solved anything yet.

I like @mySingleLive's idea to follow in CoffeeScript's footsteps. class MyClass to create a prototype, and MyClass::myMethod to get a method from the prototype.