maxim_jaffe
2020-9-10 18:06:28

Cool @samdphillips, tiny reminds me of this little class-based system for Lua :slightly_smiling_face: (https://github.com/rxi/classic/).


maxim_jaffe
2020-9-10 18:35:49

Hum the only part I don’t get is this, (define ((%object-var var) obj) , I mean I kind of get the body (I think?) but how come the head is a list in the definition..?


maxim_jaffe
2020-9-10 18:40:09

Ah it’s a curry short-hand, get it now!


maxim_jaffe
2020-9-10 18:51:47

So if I understand racket’s class system basically follows open-closed principle right? Despite classes being first-class you can only really extend them that way right? https://en.wikipedia.org/wiki/Open%E2%80%93closed_principle


maxim_jaffe
2020-9-10 18:53:21

If I understand correctly, Lua, Ruby and Javascript and to some degree Python don’t follow this principle I think?


maxim_jaffe
2020-9-10 18:53:46

And I mean without using macros note!


laurent.orseau
2020-9-10 18:54:51

You can override methods, not sure if that counts as closed?


maxim_jaffe
2020-9-10 18:55:04

think that counts as extension, so yeah closed!


maxim_jaffe
2020-9-10 18:56:56

An open class would be a nice feature for what I’m working on


maxim_jaffe
2020-9-10 19:06:35

Hum what I basically meant was classes in racket are closed for modification but open for extension, right? No way to truly modify them without a macro, yeah..?


maxim_jaffe
2020-9-10 19:08:25

Being open in that sense was something I found quite fun in Ruby and Lua..!


samdphillips
2020-9-10 19:13:26

Classes are first class, but there aren’t any documented operations on them except extension and instantiation.


laurent.orseau
2020-9-10 20:03:44

You can also create functions with arguments that return classes


spdegabrielle
2020-9-10 22:14:48

Don’t forget mixins.


samth
2020-9-11 03:17:34

Yes, the racket class system is open/closed in that sense