Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 23 22:59

    pmoura on master

    Skip lint check for `bagof/3` a… (compare)

  • Aug 23 21:59

    pmoura on master

    Add lint check for duplicated e… (compare)

  • Aug 23 18:14

    pmoura on master

    Add lint check for `bagof/3` an… (compare)

  • Aug 23 13:49

    pmoura on master

    Add lint check for calls to dep… (compare)

  • Aug 23 11:02

    pmoura on master

    Restore accidentally deleted ha… (compare)

  • Aug 23 10:26

    pmoura on master

    Fix harmless dynamic predicate … (compare)

  • Aug 23 09:25

    pmoura on master

    Fix reporting of non-portable b… (compare)

  • Aug 23 09:15

    pmoura on master

    Fix bug in the processing of mu… (compare)

  • Aug 23 08:08

    pmoura on master

    Minor compiler error handler co… (compare)

  • Aug 21 21:48

    pmoura on master

    Minor compiler code cleanup (compare)

  • Aug 20 10:49

    pmoura on master

    Fix typos in some of the `tutor… (compare)

  • Aug 19 21:06

    pmoura on master

    The SICStus Prolog adapter now … (compare)

  • Aug 19 20:18

    pmoura on master

    Update `tutor` tool to explain … (compare)

  • Aug 18 20:14

    pmoura on master

    Open included files using the s… (compare)

  • Aug 18 16:43

    pmoura on master

    Minor compiler code cleanup (compare)

  • Aug 17 18:17

    pmoura on master

    Update `tutor` tool to explain … (compare)

  • Aug 17 18:05

    pmoura on master

    Update Handbook description of … (compare)

  • Aug 17 17:49

    pmoura on master

    Add lint check for lambda param… (compare)

  • Aug 17 14:44

    pmoura on master

    Fix lambda expression examples … (compare)

  • Aug 16 09:36

    pmoura on master

    Update version to 3.29.0-b01 in… (compare)

Paulo Moura
@pmoura
That will call foo/1 in this (i.e. in the object importing the category).
YungTse Technology
@YungTseTech_twitter
That's the desired behaviour.
The object importing the category sets policy. The category provides code for using policy.
Paulo Moura
@pmoura
Note that performance will be the same (as far as message dispatching goes) as ::foo(X).
YungTse Technology
@YungTseTech_twitter
When I didn't have it dynamic, I got annoying warnings from the compiler upon compiling the category to the effect that it couldn't find foo/1 so shame on me.
Paulo Moura
@pmoura
An advantage of ::foo(X) is that it will work in the case the object gets extended or specialized.
YungTse Technology
@YungTseTech_twitter
Hmm... That is a desirable trait.
Oh, another reason for making it dynamic is that I want to be able to change policy later.
So the ability to retract and assert a new foo/1 is vital.
Paulo Moura
@pmoura
Of course, you can have both: dynamic foo/1 and use ::/1.
P.S. The design_patterns example may be good to mine for ideas.
YungTse Technology
@YungTseTech_twitter
That's what I'm doing now. Just tested it. Works like a charm in my case so far.
Paulo Moura
@pmoura
👍
YungTse Technology
@YungTseTech_twitter
Oh, I can't figure out one aspect of parametric objects.
Paulo Moura
@pmoura
?
YungTse Technology
@YungTseTech_twitter
:- object(foo(Bar)). baz(Bar). :end_object.
sigh
Paulo Moura
@pmoura
Write the code between ```
I think you mean:
YungTse Technology
@YungTseTech_twitter
:-object(foo(_Bar_)). baz(_Bar_). :- end_object.
This ... isn't doing what I'd expect it to do.
Paulo Moura
@pmoura
Ok, you're using a parameter variable there.
What did you expected?
YungTse Technology
@YungTseTech_twitter
Well, trying to.
It's not working out for me.
Paulo Moura
@pmoura
If you declare baz/1 public, you can do e.g.
?- foo(1)::baz(X).
X = 1.
YungTse Technology
@YungTseTech_twitter
Uh ... scratch that.
It's working.
Apparently my error was something different.
Paulo Moura
@pmoura
Ok.
YungTse Technology
@YungTseTech_twitter
And that got fixed, so the thing I thought wasn't working works fine.
OK, I think I'm about caught up in this batch of things I don't understand. :D
Paulo Moura
@pmoura
Just remember that parameter variables are logical variables so e.g. backtracking works as expected.
YungTse Technology
@YungTseTech_twitter
I know. That's what's so cool about them. :D
Paulo Moura
@pmoura
YungTse Technology
@YungTseTech_twitter
It's taking me a while to wrap my head around the stuff outside of "a better Prolog module", but as I use them and wrestle the concepts into my brain, I'm appreciating my decision to switch to Logtalk as my Prolog of choice even more.
What I'm doing right now in 100 lines of Logtalk would have been about 70 lines of straight-up Prolog code.
But ...
That's because I've only got the first piece implemented.
Where Logtalk will shine is that modifying this for additional variants will be, by my quick thumbnail guesstimate, about four more lines of code per added entity.
Doing the same in Prolog would be a minimum of about 20 lines per added entity.
Categories are nice.
Paulo Moura
@pmoura
Wait until you start using cateogries for hot-patching a running application 😋
Prolog code trying to mimik Logtalk features usually (1) use a larger number of lines of code and (2) are half-broken.
YungTse Technology
@YungTseTech_twitter
I've noticed the second part and kind of intuited the first part.
And you can't scare me. I've hot-patched Erlang production systems. :P
Paulo Moura
@pmoura
🙃
I have a case study for both (1) and (2) that resulted in a working system and a peer-reviwed paper:
http://arxiv.org/abs/1112.3783
Paulo Moura
@pmoura
After rewriting/porting the original P-FLAT system to Logtalk, the code was simpler, much more readable, and shorter.