News for hackers. Stuff that matters.
Re:Datomic Is Now Free by kaba0 on Thursday April 27, 2023 @03:55PM (#35733682)
I think there is a need for objects. An active connection, talking to the GPU, etc are not data -- identity is essential for their operation.

OOP is probably the best way to model such,.. well objects, allowing them a private, encapsulated state, and making it only modifiable, or even viewable through a well-defined public interface that enforces all its invariants.

Re:Datomic Is Now Free by gleenn on Thursday April 27, 2023 @04:08PM (#35733855)
Clojure uses objects for connections and things, but POJOs are harmful IMHO because it makes manipulation and collecting data a bespoke task every time. Every time you change the data, you have to change a class to represent the JSON and the ORM class and .... this is all just data
Re:Datomic Is Now Free by kaba0 on Thursday April 27, 2023 @04:28PM (#35734074)
Well, that’s what Java records are for. As for having to change the type description, that’s more of a static typing discussion, though it can be generated — having a single source of truth and generating others is imo the best approach.
Re:Datomic Is Now Free by ledauphin on Thursday April 27, 2023 @05:43PM (#35735010)
Java records weren't even a gleam in the eye of James Gosling when Clojure was solving these problems at its inception.
Re:Datomic Is Now Free by lmm on Thursday April 27, 2023 @08:13PM (#35736076)
Standard ML had records since the '70s. Both Clojure and Java would benefit from taking more from what came before, though Java at least had the excuse of being designed for low-powered set-top boxes.
Re:Datomic Is Now Free by filoeleven on Thursday April 27, 2023 @09:59PM (#35736726)
According to the link below, ML records are mostly handled by hash-maps in Clojure, except that there’s no canonical key/val order or strict typing by default.

ML record:

  {first = "John", last = "Doe", age = 150, balance = 0.12}
Clojure hash-map:

  {:first "John", :last "Doe", :age 150, :balance 0.12}
Destructuring a record in an ML function:

  fun full_name{first:string,last:string,age:int,balance:real}:string =
    first ^ " " ^ last
(It’s unclear from the example whether or not all of the destructured values are required in the function signature. I hope they are not, but I left them in since I don’t know. The caret positioning raises further questions.)

Destructuring a map in a Clojure function:

  (defn full-name [{:keys [first last]}]
    (str first “ “ last))
I don’t know if I’m missing something that ML offers with its records aside from more strict typing, which you can also have in Clojure when it’s useful. In both cases, it looks like it’s applied at the function declaration and not the record declaration.

https://www.cs.cornell.edu/courses/cs312/2008sp/recitations/...

Re:Datomic Is Now Free by simongray on Friday April 28, 2023 @03:32AM (#35738539)
Clojure has records too.
Re:Datomic Is Now Free by kaba0 on Friday April 28, 2023 @12:32AM (#35737497)
In his eyes? It definitely was a thing, records are just nominal product types, these are probably the single most used building block of programming languages.

I really like Clojure, but I really don’t know what some of its fans think (also true of other lisps), like there is a healthy pollination of ideas between languages, lisps are not God’s language.

Re:Datomic Is Now Free by waffletower on Thursday April 27, 2023 @04:42PM (#35734253)
I think OOP (object oriented programming) is abused and is not the optimal paradigm for most software services. It succeeds best at providing inter-operability structure for API design. "Objects", as mentioned here, are an abstraction. Stateful data can be organized and manipulated elegantly without use of the OOP paradigm. Many small systems that employ OOP hamper their maintenance and extendability by unnecessary dependence upon encapsulation and data ownership. Mutability is a villain here as well -- when data structures are immutable, there is little fear of panoptic architectures designed without ownership constraints. Here software is no longer corralled into walled gardens of "objects"; large complex types and their brittle method associations are avoided, greatly simplifying software architectures as a result.
Re:Datomic Is Now Free by filoeleven on Thursday April 27, 2023 @06:38PM (#35735409)
Connection pools exist precisely because the code outside of the connection management piece shouldn’t have to care much whether or not there is an active connection. It’s all boilerplate, except for handling the “unable to connect” case.

When you call a connection or connection pool object, you’re querying its current state. This is absolutely data.