To simplify such a legacy oop in other languages,
We will need the Naming expander above,
.
Next thing to we do…
.
Declarative macros? or homoiconcity datastructure.
.
This is a code I wrote for fun while studying about 8 years ago.
There were times when I felt like maybe monad, but I forgot about that.
in nix
rec { <--- This allows rec to access with different name / recursion.
a ={ b=3; }
c = { d = a.b; }
}
There seems to be value in using this as @. (Do not write everything above like let.)
(rec {
(setv a { b 3 } )
(setv f #(+ 1 %))
(setv c { d @a.b { e @@a.b f @d g (@@f 2) } })
})
But
If @ is allowed in the definition, it’s messy, so a slightly different example.
(class A{ <--------------- Actually, it is better not to have rec (if it is declarative code anyway), and substitute/trap in front of it to declare a virtual class A
(setv a { b 3 } )
(setv c { (d a.b) { (e a.b) } })
(setv f #static ...)
})
@ is used after instancing.
The @ keyword is more conspicuous when used in instance code as we use it in atom maps.
(However, when I first saw @, it was like c pointer variable operation as in the screenshot, but I had been thinking about where to use it for a long time (8 years…). after nix experience, As above, I thought it could be used in legacy oop definition like schema? functional languages, so clojure developers wondered if this is what we should go to.)
(-> (A) (@c.d).e )
(-> (B (A)) ...) < ----------- B accepts A instance as a constructor function, and B instantiates it immediately.
Just my personal imagination.
Of course, the class example definition shown there.
I thought it was necessary to aim for a class 1:1 definition between java for jvm languages.
all. (Unified simplicity)
Even if there were such a thing, I wouldn’t be an dumb not to use the basic nice functional features of clojure. But Java or JavaScript? typescript? etc… I think the story is slightly different in the case of interaction. Like hylang, 1:1 matching of dot names is essential. (And it is understandable that everyone asks why such expressions are needed in the value returned to method chaining about the sorry about that would my Mistakes in my stupid thinking. Please understand.
So
It’s a nonsensical code, but I think it will maximize the value of clojure.
thanks.