Discussions related to Visual Prolog
daveplummermd
VIP Member
Posts: 80
Joined: 18 Jul 2006 17:18

compound domains as return values?

Unread post by daveplummermd »

Hello

Is it possible to declare a procure in an interface to a class that returns a compound domain?
Such as:

Code: Select all

interface X getDates()->dates Dates. end interface X
where the return domain is defined:

Code: Select all

domains dates = d (integer,integer,integer).
Thanks in advance,
Dave
Dave Plummer
Harrison Pratt
VIP Member
Posts: 432
Joined: 5 Nov 2000 0:01

Re: compound domains as return values?

Unread post by Harrison Pratt »

VIP 7 & 8 forbid naming domains and facts with the same name, unlike VIP 5x. This seems like an annoyance when you are upgrading your code and thinking from 5x, but it will save you debugging time in the future.

This sort of approach works:

Code: Select all

class dateStore : dateStore     open core end class dateStore

Code: Select all

implement dateStore     open core facts     date_fact : ( integer, integer, integer ). clauses     tryGetDate() = date(M,D,Y) :-         date_fact(M,D,Y),         !. end implement dateStore

Code: Select all

interface dateStore     open core domains    dateDOM = date( integer, integer, integer ). predicates     tryGetDate : () -> dateDOM determ. end interface dateStore
Also, shouldn't dates = d (integer,integer,integer). in your example be date = d (integer,integer,integer) ?
daveplummermd
VIP Member
Posts: 80
Joined: 18 Jul 2006 17:18

Re: compound domains as return values?

Unread post by daveplummermd »

Thanks so much.
Dave Plummer
Post Reply