Page 1 of 1

Support for type-checking in logtalk?

Posted: Wed Feb 27, 2008 3:48 pm
by Parker
Has any thought been given to support for types in Logtalk?

I recently came across this post by Tom Schrijvers which describes an extension to prolog that allows static type-checking.
http://tomschrijvers.blogspot.com/2008/ ... prolog.htm

The features I particularly like are:
- It is optional. The user isn't forced to use types.
- After an initial type check there is no further runtime overhead.

So my question is, could logtalk benefit from an optional lightweight type-system like this?

Re: Support for type-checking in logtalk?

Posted: Sat Mar 01, 2008 11:21 am
by Paulo Moura
Hi!

I talked with Tom briefly about bringing the type-checker to Logtalk. I expect that the type-checker being developed could be adapted to Logtalk with some work after adding a type/1 directive to Logtalk. Is too soon to tell. And it's not currently a priority for Logtalk development.

Some of the functionality of a type-checker can be implemented in the current Logtalk version. By using a hook object that parses the mode/2 directives, is possible to generate event-handling code that checks method calls and returns. Events would be turned on for debugging and testing and turned off for runtime performance.

I suggest you open an enhancement ticket at http://trac.logtalk.org/ with your proposal.

Happy logtalking!

Paulo

Re: Support for type-checking in logtalk?

Posted: Thu Apr 17, 2008 2:50 pm
by Parker
As requested, ticket is submitted here:
http://trac.logtalk.org/ticket/10

Re: Support for type-checking in logtalk?

Posted: Thu Apr 17, 2008 3:02 pm
by Parker
Incidentally, I think some people are frustrated with the enforced rigour of Mercury where it is mandatory to specify types. Freedom to choose is best.

BTW the link I supplied initially is broken. This should work:
http://tomschrijvers.blogspot.com/2008/ ... rolog.html