News for hackers. Stuff that matters.
Re:Revisiting the principles of data-oriented programming by deltaonefour on Sunday June 26, 2022 @01:22AM (#31881342)
One way to define it is to look at the thing that's unique to OOP that isn't used in any other paradigm.

In OOP data and method are unionized into primitives that form the basic building blocks of your program.

This is unique to OOP. It must be the definition. Defining it in terms of message passing, encapsulation and inheritance are not as good because these concepts are used in other paradigms as well.

Re:Revisiting the principles of data-oriented programming by danielscrubs on Sunday June 26, 2022 @02:02AM (#31881509)
Wouldn’t closures and let’s say “type-driven” also support your definition? It’s quite tricky as sometuple.fun() and fun(sometuple) might as well be interchangeable. If you really want to support a formal definition it would probably be best to have it in denotational semantics… not an easy task.
Re:Revisiting the principles of data-oriented programming by jcelerier on Sunday June 26, 2022 @03:48AM (#31881949)
Closures aren't reusable across a whole program unlike classes since their type isn't named, and they don't allow to have more than one operation on the data held by the closure. They really are "poor man's objects" ;p
Re:Revisiting the principles of data-oriented programming by uryga on Sunday June 26, 2022 @06:23AM (#31882603)
they allow as many operations as you need, just pass in a "method name" :)

  const p = Point(3, 5)
  p('getX') // 3
  p('up', 11)('toString') // "Point(3, 16)"


  const Point = (x, y) => (method, ...args) => {
    switch (method) {
      case 'getX': return x;
      case 'getY': return y;
      case 'toString': return `Point(${x}, ${y})`
      case 'up': return Point(x, y+args[0]);
      // ...
    }
  }
(unfortunately statically typing this statically requires... some work, either sth like [typescript overloads + literal types] or full on dependent types)
Re:Revisiting the principles of data-oriented programming by deltaonefour on Sunday June 26, 2022 @04:08AM (#31882028)
Most things in programming aren't formally defined. It is especially hard given the isomorphisms everywhere.

At best what I've done here is eliminate some of the vagueness surrounding the definition, which is really all that's needed in most cases.