News for hackers. Stuff that matters.
Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @06:57AM (#13183971)
So how do you use Rust without traits?
Re:Zygomys – An embedded scripting language for Go by tatterdemalion on Thursday December 15, 2016 @02:11PM (#13187244)
What is your definition of "object system"? I'm afraid it seems open enough to include any system for polymorphism.

(As an aside: I am the author of several Rust trait RFCs & I have read "Traits: Composable Units of Behaviour," though "How to make ad-hoc polymorphism less ad-hoc" is more relevant to Rust. Your smugness about this toward the other poster is not appreciated.)

Re:Zygomys – An embedded scripting language for Go by pjmlp on Friday December 16, 2016 @01:13AM (#13191436)
My definition is the same as the CS literature expressed in SIGPLAN, OOPSLA and ECOOP papers, written by people doing OOP language research since the mid-70s. No need to invent my own.

As for the other poster, sorry if it appears like that. I did not offended anyone and provided information where to read more about trait systems.

HN comments are not big enough to provide an history of OOP systems, their similarities and differences.

Re:Zygomys – An embedded scripting language for Go by tatterdemalion on Friday December 16, 2016 @06:32PM (#13197863)
I've been kind of aggressive in response to your comments, because I've found them condescending, but I think what we're actually revealing is that the way you're using "object-oriented" is ontologically discontinuous with the conception of languages derived from their formal semantics as I understand it. Features with the same formal semantics (Rust traits & Haskell type classes), expressed through distinct syntax, can correspond to different concepts in the ontology of languages which object-orientation exists within.

I might be tempted to say that object-orientation has no explanatory value - "it just means polymorphism!" - but I think what's more accurate is to say that its explanatory value operates within a distinct discourse from the discourse I am familiar with.

Re:Zygomys – An embedded scripting language for Go by lacampbell on Thursday December 15, 2016 @03:43PM (#13188206)
> Your smugness about this toward the other poster is not appreciated.

I don't see him being smug at all. Is it smugness to suggest reading material to someone when they've shown ignorance of a topic? People do that to me here often from time to time and I don't interpret it as "smugness".

Re:Zygomys – An embedded scripting language for Go by tatterdemalion on Thursday December 15, 2016 @06:35PM (#13189742)
It is when you make the recommendation in a tone which is didactic, patronizing, and superior. That's the definition of smug (I've also found your comments somewhat smug).
Re:Zygomys – An embedded scripting language for Go by lacampbell on Thursday December 15, 2016 @07:07PM (#13189949)
If you find it smug that's really your problem. It's a bit tiresome to see people talking about OO when they haven't educated themselves about OO at all. Which is probably why I don't like Rich Hickeys talks, incidentally.
Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @04:31PM (#13188621)
I don't see any links to the relevant material, just namedropping
Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @07:28AM (#13184103)
I use Rust with traits. But I don't have classes or objects.
Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @07:36AM (#13184146)
Traits are also OOP, not all OOP == Java.

In fact, traits related OO research goes back to Smalltalk variants and Lisp Object Systems.

Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @10:11AM (#13185067)
Traits are more like better interfaces, not classes. Rust doesn't have objects either. It's all structs.
Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @11:23AM (#13185678)
I know what traits are, both in Rust as well as in language design, better read some SIGPLAN and OOPSLA papers about traits and OOP.
Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @04:31PM (#13188613)
I'm asking you to explain how that relates to objects and classes since I use neither of those when I use traits.
Re:Zygomys – An embedded scripting language for Go by pjmlp on Thursday December 15, 2016 @05:33PM (#13189245)
Well, you can start here:

https://en.wikipedia.org/wiki/Trait_(computer_programming)

"a trait is a concept used in object-oriented programming, which represents a set of methods that can be used to extend the functionality of a class."

Then follow on protocols as an idea of generic interfaces

https://en.wikipedia.org/wiki/Protocol_(object-oriented_prog...

Then travel back in time to 2003 and read the European Conference on Object-Oriented Programming (ECOOP) paper "Traits: Composable Units of Behaviour" for a possible view on traits long before Rust was born.

The way programming languages do information hiding, polymorphism, method/function dispatch, data modelling is also part of OOP and there are several ways to combine them.

OOP is so much more than just plain objects and classes.

Re:Zygomys – An embedded scripting language for Go by tatterdemalion on Thursday December 15, 2016 @06:31PM (#13189719)
The implementation of traits described in that paper is totally different from the implementation of traits in Rust. Rust has adopted an ontology and syntax familiar to programmers in object oriented programming to make accessible a form of polymorphism which is quite different.

In fact, the same concept exists in Haskell, where it is called "type classes." (In this case, I think the adoption of OO terminology is harmful to comprehension, rather than helpful). Are we to believe that Haskell is object-oriented also? Is there a language with polymorphic abstraction that is not object-oriented in your formulation?

Re:Zygomys – An embedded scripting language for Go by pjmlp on Friday December 16, 2016 @01:19AM (#13191458)
Yes Haskell type classes are interfaces from OOP point of view.

And given time on the weekend I might try to find out the talk given by SPJ about this very issue.

Polymorphism and dynamic dispatch are part of OOP.

EDIT: Found Simon's talk

Adventure with Types in Haskell, part 1 and part 2:

https://www.youtube.com/watch?v=6COvD8oynmI

https://www.youtube.com/watch?v=brE_dyedGm0

At 1:01:01 on the first lecture he discusses how Haskell relates to OOP in regards of subtyping and generic polymorphism and how although different on the surface they share those CS concepts in their own ways.

https://www.youtube.com/watch?v=6COvD8oynmI&feature=youtu.be...

Re:Zygomys – An embedded scripting language for Go by tatterdemalion on Friday December 16, 2016 @01:51PM (#13195681)
I've seen SPJ's talk. You might notice that in the moment you site, he says that OO and parametric polymorphism are both polymorphism systems. Rust and Haskell are both parametric systems, not OO systems, in SPJ's formulation (and mine). The slide is literally a venn diagram of the two concepts and the abstractions they can encode.

What is an example of a language with polymorphism you do not consider to be object oriented? I'm not really interested in being linked to media I've already seen, I'm trying to suss out what you think object oriented means. As far as I can tell, it means "polymorphism," and well - yes I think polymorphism is a great idea, but I don't think its what most people mean when they say "object-oriented."

(Also, if Haskell type classes are interfaces, then so are Rust traits. They have the same semantics. But you've already said that Rust traits are traits.)

Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @07:21PM (#13190013)
Again, it might be concepts developed in OOP languages, but I'm still not using objects. I never said I'm not using OOP, which is a stronger claim. I said I'm not using objects.
Re:Zygomys – An embedded scripting language for Go by pjmlp on Friday December 16, 2016 @01:25AM (#13191476)
Yes, but OOP means Object Oriented Programming.

Rust traits are easily modeled in UML, just to add another point to it.

Better stop here then.

Re:Zygomys – An embedded scripting language for Go by iopq on Friday December 16, 2016 @10:00AM (#13193657)
Yes, Object Oriented Programming.

Not Object Programming. I'm not using any objects when I write Rust code, even if I'm using concepts from OOP. But yeah, we've both made our point.