An idea for combining OOP and FP #347
chebert
started this conversation in
Cool Coalton Code
Replies: 1 comment
-
Wow, I first just wanted to say that this is awesome! It'll take me a little bit to dig into it and understand it. Thanks for sharing! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As promised, here has been my Coalton project for the last couple of weeks.
The idea is based on Alan Kay On Messaging. An attempt to make an Object system with assignments as "metalevel changes from functions" and a focus on messages.
Entities are then defined as functions which take a enveloped message and return: new messages, new system-requests, and a new interface.
Interesting to note is that entities are not provided with a global environment and have no knowledge of other entities, other than what they are given when they are constructed or what they receive from messages.
Finally, late-binding comes into play with messaging: all that's needed to send a message is an address (in this case a unique id) and a message.
I wrote a concrete implementation of SICP's Simulator for Digital Circuits. There were some issues with synchronization because of the asynchronous message-sending.
Without further ado, my attempt at merging Functional Programming and Object Oriented Programming:
FPOOP.
https://gist.github.com/chebert/e8ce3bc8621174e4e2b12426af9a9a12
Beta Was this translation helpful? Give feedback.
All reactions