Re: mutable object model
Paulo Moura <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 14/11/2013, at 16:21, Alan Baljeu <[email protected]> wrote: >> One may view a psi-term as a generalization of conventional > >> Prolog terms in that subterm positions are specified by explicit numeric >> keywords rather than implicit numeric positions." >> >> So this would be a psi-term: >> car(manufacturer => "Ford", wheels => 4) >> as would this: >> car(wheels => N) >> *and* these two psi-terms can be unified, giving >> N = 4. > > Just as a matter of program maintenance I use macros in > Prolog to achieve this, such that in my code > #car(manufacturer: "Ford", wheels : 4) > maps at compile time into > car("Ford", _, _, 4, _) > -- if I declared car as a struct -- and then of course unification just works. > >> There's even more: There is a notion of inheritance between functors >> ("sorts"), so given appropriate declarations, one of the terms could have >> the functor 'vehicle', for instance. It's an interesting read. > > > This would be so handy for what I'm doing now, but I don't have a means. Logtalk's parametric objects and parametric object proxies provides you with the inheritance bit. Together with your macros to abstract the position and access arguments by name instead of position, it may provide you with a workable solution. Cheers, Paulo ----------------------------------------------------------------- Paulo Moura Logtalk developer Email: <mailto:[email protected]> Web: <http://logtalk.org/> -----------------------------------------------------------------