top | item 39923260

(no title)

hasty_pudding | 1 year ago

"all functions are pure, there is no data mutation, and entities are represented by data structures instead of objects."

God i love to see this

discuss

order

recursive|1 year ago

In javascript, what data structure can you implement without objects? Pretty much nothing. Even arrays are objects.

hasty_pudding|1 year ago

What they mean is functions and data are separate, emulating a more functional paradigm and less mutable state.

The functions are kept pure and the data is kept pure.

As opposed to an object oriented programming style in which data and functions share the same object and create bug ridden state machines thats not as easy to reason about.

Some further explanation about this:

https://www.goodreads.com/quotes/702062-immutable-objects-ar...

a semi-nuanced discussion:

https://www.reddit.com/r/scala/comments/ejwsp1/is_mutability...

you can just Google mutable state to find more info.

separating your data structures and functions in many cases will make your code cleaner and more bug free.

hasty_pudding|1 year ago

What languages on Earth implement non-primitive data structures without objects?

I guess maybe low level c and assembly where you implement everything as bits in physical memory?