| First of all lets be clear: the concepts of "first class" and "callable" are procedural terminology coming from object oriented and functional languages. I am admitting them to the discussion for purposes of comparative language analysis. My criteria is "if a reasonable
person would recognize a language construct in Prolog as similar to an equivalent language construct in an OO or FP language, we can discuss it as if it were the same". However, this is a charitable
interpretation that is open to abuse if desired. It is starting to sound like the criticism is that Prolog is not an object oriented programming language and does not pass contextual object information along with symbols in the same way SICP-style higher order functions are treated in functional
programming languages. This is by design, Prolog is a logic language that describes relationships, not a procedural language. There is no behavioral difference that distinguishes a Prolog predicate as not "first class". There are many metapredicates designed to accept predicates as arguments, such as maplist/N. This is the primary criteria for supporting first class "callables" (another word poorly suited for Prolog, but I'm admitting it for purposes of conversation) in other languages. I would have assumed that would be a sufficient behavioral affordance. > there are first-class callable things and second-class callable
things To make this more concrete, please provide some examples of "first-class" and "second-class" "callable things" in Prolog, as well as an example of "first class" and "second class" "callable things" in another language. Given your level of confidence in your argument, I assume this should be fairly easy to do. Then we might have a concrete basis for discussion. |
Not for you, but purely for the benefit of unfortunate souls who wander by and are confused what there is to argue about:
This predicate calls some other predicate `call_direct/2` in a first-class way. It's a call.It also calls some predicate identified by whatever the variable IndirectCallTarget may be bound to. This is a second-class call. It's frequently referred to as a "meta-call" to signal that it's not a first-class call. It's important to note that the value passed in for the IndirectCallTarget parameter is not a predicate. It cannot be, since there are no predicate values in Prolog. It's the name of a predicate. (Plus maybe a partial argument list; still not a predicate.) Since the thing being meta-called is not a predicate, it must be meta-called specially using the `call/N` builtin. The user has no realistic way of implementing the `call/N` builtin themselves.