lingy

slipset 2023-07-28T07:03:43.933789Z

WRT the persistent data structures. In Clojure they were implemented in Java, and based on Java interfaces. In Clojurescript, they’re all implemented in Clojure and based on protocols. I think the latter is preferable. One would then end up in a world where Perl was missing an implementation of persistent data structures, but that could be addressed in other ways :)

slipset 2023-07-28T07:05:21.039399Z

Also, depending on a lot of things, there is clojure.tools.reader and clojure.tools.analyzer which are the reader and analyzer implemented in Clojure.

hifumi123 2023-07-28T09:38:31.839349Z

indeed

hifumi123 2023-07-28T09:39:05.772929Z

to fast track lingy, we will want to get deftype and defprotocol nailed down first, and then we can take most of CLJS' implementation of clojure.core

Ingy döt Net 2023-07-28T12:56:07.752989Z

This took a few minutes to sync in but getting it now.

Ingy döt Net 2023-07-28T13:13:24.661069Z

s/sync/sink/ # really not awake yet

hifumi123 2023-07-28T09:39:44.099689Z

(also fun fact -- deftype was originally intended to make implementing "clojure in clojure" possible, but that never happened)

Ingy döt Net 2023-07-28T12:38:33.565019Z

@slipset can you give me a good urls about protocols? I don't think I'm familiar...

slipset 2023-07-28T12:39:30.272799Z

https://clojure.org/reference/protocols

🙌 1
slipset 2023-07-28T12:40:03.854809Z

You can think of them as Java Interfaces.

Ingy döt Net 2023-07-28T12:40:24.869909Z

wasn't sure if that was a clojure, java or js thing

Ingy döt Net 2023-07-28T12:42:47.389409Z

is there a tool to transform java interfaces to protocols?

slipset 2023-07-28T12:42:57.597289Z

Don’t think so.

Ingy döt Net 2023-07-28T12:57:37.480429Z

I'm using "I just opened my eyes a few minutes ago" as an excuse to why it took most of those minutes to see where you both were going.

Ingy döt Net 2023-07-28T12:59:48.766489Z

We can implement the Clojure Java classes in Lingy after we have defprotocol (interfaces) and deftype (lingy implementations). Right?

Ingy döt Net 2023-07-28T13:00:26.318739Z

(And we steal the implementations for ClojureScript)

Ingy döt Net 2023-07-28T13:01:11.817129Z

making coffee brb

Ingy döt Net 2023-07-28T13:09:49.497779Z

Adjusting my mental models for Lingy. I was working towards Lingy's lingy/core.ly being Clojure's clojure/core.clj verbatim (or close) Assuming that's what ClojureScript did... But cljs/core.cljs is not the same at all.

Ingy döt Net 2023-07-28T13:10:02.839099Z

TIL 🙂

Ingy döt Net 2023-07-28T13:12:35.124169Z

core.cljs is 50% bigger because (I assume) it implements the primitives in clojure (not Java)

hifumi123 2023-07-28T17:11:27.953089Z

not only that but theres extra things that dont exist in java, like converting ES6 iterators to seqs

✅ 1
Ingy döt Net 2023-07-28T13:50:32.756759Z

I'm sussing out the dependency chain to implement those 2 in Lingy

Ingy döt Net 2023-07-28T14:00:01.995189Z

Implementing the deps for clojure/core_deftype.clj looks overwhelming at the moment 😕

Ingy döt Net 2023-07-28T14:01:24.029309Z

I think I am right to concentrate immediately on porting the ASeq based classes as so much depends on them

Ingy döt Net 2023-07-28T14:02:03.976979Z

And to make the dependency graph generator program for the clojure source code.

Ingy döt Net 2023-07-28T14:09:28.598469Z

Which could give a pretty clear answer for questions like: "If I want to implement defprotocol now in Lingy's current state, what work is involved?"

2023-07-28T16:11:56.617989Z

I suppose deftype and defprotocol are areas in which the other hosts' implementations might be not directly applicable to a new host. The key is how protocols and types would work in Perl. Suppose each protocol and each type is a Perl package. Types extend (`@ISA`?) protocols. Instances are blessed as a type. But Clojure also allows protocols to be extended to instances regardless of their type (https://clojure.org/reference/protocols#_extend_via_metadata). Maybe that means a common Lingy base package that all Lingy deftype packages cite as a super, and the Lingy base package does something to dispatch method calls to an instance's extra protocols? Or maybe an instance with protocol metadata makes Lingy make a new, single-purpose Perl package?

Ingy döt Net 2023-07-28T16:28:46.912459Z

Nod. Lots of ways to get that done in Perl.

Ingy döt Net 2023-07-28T16:31:23.679259Z

I think gen-class in Perl will likely want some kind of meta field to specify which of the 50 ways in Perl you want that class genned 😕

Ingy döt Net 2023-07-28T16:32:13.325799Z

with a very bare-bones default

Stephan Renatus 2023-07-28T18:13:08.544169Z

@stephan.renatus has joined the channel