Re: [stack] What does "concatenative" actually mean?
Daniel Ehrenberg <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
> They're useful. Tons of code is written in Forth. Factor has shown > tremendous progress in a very short period of time. If you're > interested in how such languages can be productive, I'd encourage you > to download Factor and get to work. > > Factor offers an OO system which may make you feel more at home, > although it's based on multiple dispatch (I think) rather than message > passing; the former makes more sense for a concatenative language. I > don't know the system well enough to give you an example to your > problem, although I'm sure asking on the #concatenative channel on > Freenode would get you results; quite a few Factor programmers hang > out there. > >> Is there a way to accord concatenation and basic OO? Or are these >> approaches -- as I suspect -- definitely incompatible? > > They're not incompatible. Many Forths have objects, Factor has > objects, and I believe there was talk of adding a prototype-based > object system to Cat at one point as well. If you want to reimplement > Io in Factor, you'd be more than able to. I'd encourage you to try the > existing system first though and see what you think. Factor's OO system isn't based on message passing. Generic words are words that can have methods defined on them for certain classes, like Lisp. But multiple dispatch mostly isn't used (yet); there's a library for multiple dispatch that's not in core. Factor's object system used to be a unique hybrid between being class-based and including delegation, but now it's more traditional. There are things that are like structs, that can have single inheritance among each other. Then, there are mixins, which are really extensible union classes that take the place of declaring that a class implements a certain interface. (It's not actually enforced that the class does implement the interface.) There are also predicate classes, singleton classes and a few other convenient things. The library defines more (eg multimethods, delegation), since all the internals of the object system are fully hackable. I think Eduardo Cavazos wrote a prototype-based OO system in Factor, but I'm not sure if it's still around. Generally, Factor is flexible enough that you can implement whatever object system you want as a library, and it can be made pretty efficient. Factor's object system used to be just a library, but now it gets special help from the compiler (type inference is used to reduce dispatch, etc), so it can't really be considered that way now. Dan