News for hackers. Stuff that matters.
Re:Zygomys – An embedded scripting language for Go by lacampbell on Thursday December 15, 2016 @01:20PM (#13186768)
The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures." Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress. On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened.

I regard rusts structs + traits as an object system. But I understand why they chose to not mention objects at all - they don't want to conjure up images of Java boiler plate and heavy mutation, which is sadly what it means to most people now.

Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @04:33PM (#13188643)
> I regard rusts structs + traits as an object system

I don't regard them as an object system because they are à la carte, while objects tie data and behavior together

Re:Zygomys – An embedded scripting language for Go by lacampbell on Thursday December 15, 2016 @07:15PM (#13189984)
à la carte in what sense?

I feel like data and behaviour is very much tied together in a rust struct. With the right visibility modifiers it can be completely opaque - it's literally a black box you are sending messages to. The methods are attached to the object in my mind.

But I am by no means a rust expert. I'm curious is to why you think the data and behaviour are not tied together.

Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @07:24PM (#13190028)
Because you can have free functions that take plain data. So you can have methods or you can have free functions. This is why it's à la carte - you can choose if you use methods or free functions. You can choose if your data has behavior or not.
Re:Zygomys – An embedded scripting language for Go by lacampbell on Thursday December 15, 2016 @07:29PM (#13190049)
Right, absolutely. I am by no means claiming rust is an OO language, just that I would consider the structs + traits thing a way of making objects. I suppose I could have been more precise - it's not an object system by itself but it certainly can be very easily used as one. I think for a systems langauge they did a very fine job in designing that part of it.
Re:Zygomys – An embedded scripting language for Go by iopq on Thursday December 15, 2016 @09:15PM (#13190547)
I mean, only if you're viewing it from that point of view. A Haskell programmer would just say Rust has typeclasses.