by simplify · 9y ago · 0 comments
Here's another interesting concatenative language in development that I'm following: http://kittenlang.org/
In particular the object/class system of Factor was baffling to me. The paradigms just don't fit together well.
I also think Lisp has an awkward object system(s). If you want that paradigm, I think a dedicated language is better.
Object systems crammed into Forth will always be baffling, the fact that it's doable doesn't make it a good idea.
I don't really buy into OOP at all; but i strongly prefer CLOS to alternatives, including Smalltalk; as it let's me reuse pieces of functionality without dealing with the rest.
Using a fundamentalist language as a foundation will always come back to bite you from my experience. I prefer my foundations as general purpose as possible, which usually means C or Common Lisp.
object.foo.bar
is apt to read more like this: (class2-bar-of (class1-foo-of object)) (bar (foo object))
I mean, I understand that "a.foo" (class A) does not represent the same name as "b.foo" (class B) due to scoping rules, and so logically you would have to use (a-foo a) and (b-foo b) if you wanted to replicate the same in CLOS. But on the other hand, FOO can be generic and applied to different types of objects. You might even have a mixin providing the FOO slot, which classes A and B inherit from.I find the notation fine, it looks like regular function application (some people prefer threading macros, I personally don't care).
Note also that CLOS allows you to add code "between the dots" by specializing accessors on qualifiers (:before, :after, :around), which can be useful to add orthogonal things like logging, persistency, ...
object.foo.bar
similar as 1+2+3
The later would be (+ 1 2 3)
in Lisp.Thus slot access could be written as:
(? object foo bar)
All we need would be a macro ?, which is easy.Alternatively we can write a reader macro such that we can write:
#?object.foo.bar
The problem with short names and possible package prefixes remains: (? w1 ws:panes ws:background-color color:name)
vs. #?w1.ws:panes.ws:background-color.color:name
vs. (color:name (ws:back-ground-color (ws:panes w1)))