Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 18 15:56

    pmoura on master

    Workaround limitations of xUnit… (compare)

  • Jan 17 23:05

    pmoura on master

    Minor update to the sample sett… (compare)

  • Jan 17 19:55

    pmoura on master

    Fix the `logtalk_tester` script… (compare)

  • Jan 16 14:45

    pmoura on master

    Fix a portability issue with SI… (compare)

  • Jan 16 14:41

    pmoura on master

    Add port of Amzi! Inc "Nani sea… (compare)

  • Jan 15 18:03

    pmoura on master

    Update release notes (compare)

  • Jan 15 15:20

    pmoura on master

    Improve `lgtunit` tool document… (compare)

  • Jan 15 12:42

    pmoura on master

    Update `lgtunit` tool documenta… (compare)

  • Jan 15 10:53

    pmoura on master

    Update `logtalk_allure_report` … (compare)

  • Jan 15 10:26

    pmoura on master

    Improve `logtalk_tester` script… (compare)

  • Jan 14 23:02

    pmoura on master

    Minor update the `logtalk_teste… (compare)

  • Jan 14 21:33

    pmoura on master

    Update `logtalk_tester` script … (compare)

  • Jan 14 19:04

    pmoura on master

    Update the `logtalk_allure_repo… (compare)

  • Jan 14 18:18

    pmoura on master

    Fix failed test data output bug… (compare)

  • Jan 14 17:40

    pmoura on master

    Fix typo in the xUnit.net v2 fo… (compare)

  • Jan 13 23:32

    pmoura on master

    Improve instructions for using … (compare)

  • Jan 13 23:14

    pmoura on master

    Minor improvement to the Handbo… (compare)

  • Jan 13 22:50

    pmoura on master

    Minor improvement to the Handbo… (compare)

  • Jan 13 20:00

    pmoura on master

    Improve `lgtunit` tool document… (compare)

  • Jan 13 14:36

    pmoura on master

    Fix typo in `logtalk_allure_rep… (compare)

YungTse Technology
@YungTseTech_twitter
http://vpaste.net/mZZwi This is emphatically not the case.
http://vpaste.net/z8GQx The category shows both methods, but only has one of them public: the one it defined locally. The one it's implementing from the protocol is not public. But NEITHER of them, whether flagged public or not, is actually showing in the object that imports the category.
I can call these imported methods using ::/1 from within the foo object, however.
YungTse Technology
@YungTseTech_twitter
What does "public" mean on an interface? A category? And why do the docs at https://logtalk.org/manuals/userman/categories.html#importing-categories seem to imply that public predicates should import publicly? Or am I have serious reading difficulties?
Paulo Moura
@pmoura
Hi. I'm not that familiar with gdb. But the Logtalk debbuger supports breakpoints in clauses (set using the clause first line and the name of the entity containing it) basides the traditional Prolog style spy points.
This message was deleted
This is correct:
?- object_property(foo, Prop).
Prop = context_switching_calls ;
Prop = source_data ;
Prop = static ;
Prop = file('/Users/pmoura/junk.lgt') ;
Prop = file('junk.lgt', '/Users/pmoura/') ;
Prop = lines(24, 27) ;
Prop =  (public[]) ;
Prop = protected([]) ;
Prop = private([]) ;
Prop = number_of_clauses(0) ;
Prop = number_of_rules(0) ;
Prop = number_of_user_clauses(0) ;
Prop = number_of_user_rules(0).
But what you're looking for is:
Paulo Moura
@pmoura
?- foo::current_predicate(P).
P = fc_method/0 ;
P = fp_method/0 ;
false.

?- foo::predicate_property(fp_method, P).
P = logtalk ;
P = scope(public) ;
P =  (public) ;
P = static ;
P = declared_in(foo_protocol) ;
P = declared_in(foo_protocol, 3) ;
P = defined_in(foo_category) ;
P = defined_in(foo_category, 12) ;
P = number_of_clauses(1) ;
P = number_of_rules(1).

?- foo::predicate_property(fc_method, P).
P = logtalk ;
P = scope(public) ;
P =  (public) ;
P = static ;
P = declared_in(foo_category) ;
P = declared_in(foo_category, 10) ;
P = defined_in(foo_category) ;
P = defined_in(foo_category, 17) ;
P = number_of_clauses(1) ;
P = number_of_rules(1).
You need to read the chapter on reflection in the Logtalk handbook. You want the behavioral reflection API, not the structural reflection API.
YungTse Technology
@YungTseTech_twitter
No, that's not what I'm talking about.
When I "implement" a protocol that has a method flagged "public" I would expect that method to be available. It isn't.
When I "import" a category that has public methods, I would expect that method to be available. It isn't.
The properties thing there was just to show that it's going in weird places I don't expect.
Paulo Moura
@pmoura
?- foo::fp_method.
fp_method: self: foo this: foo
true.

?- foo::fc_method.
fc_method: self: foo this: foo
true.
Which is the expected results.
YungTse Technology
@YungTseTech_twitter
?- foo::fc_method.
! Permission error: access protected_predicate fc_method/0
! in goal: foo::fc_method
! with execution context:
! entity: user
! sender: user
! this: user
! self: A
! meta-call context: []
! coinduction stack: []
! The predicate is protected and not within the scope of the sender or caller.
!
This is the unexpected result I'm getting.
Paulo Moura
@pmoura
I'm using your code at http://vpaste.net/gqc7y
YungTse Technology
@YungTseTech_twitter
Oh, wait. I was experimenting and left the experimental results in.
OK, I have no idea what's going on. When I return to the original code it started working. Which leads me to believe I typoed something earlier.
Paulo Moura
@pmoura
Do you understand now the different views provided by the object_property/2 predicate and the current_predicate/1 + predicate_property/2 methods?
YungTse Technology
@YungTseTech_twitter
Oh, I always did. I was just using the *_property things as a shortcut to see where the stuff was going.
Paulo Moura
@pmoura
But the object_property/2 predicate doesn't provide an operational view but a structure view.
YungTse Technology
@YungTseTech_twitter
But that structural view was where I was seeing that it had nothing public.
Paulo Moura
@pmoura
Which is correct.
There's nothing declared public inside the object.
YungTse Technology
@YungTseTech_twitter
OK, so future reference, then, don't use *_property when trying to puzzle out an inheritance bizarreness.
Paulo Moura
@pmoura
Depends on the view you want. Do read the handbook section on reflection.
YungTse Technology
@YungTseTech_twitter
Does any of the examples show a simple use of log_talk::print_message/3?
I'm having troubles doing a simple "Hello world" with it. :-/
:- object(hello).

    :- multifile(logtalk::message_tokens//2).
    :- dynamic(logtalk::message_tokens//2).
    logtalk::message_tokens(hello, hello(What)) -->
        ['Hello, ~w!'-[What], nl].

    :- public(main/0).
    main :- logtalk::print_message(information, hello, hello('World')).

:- end_object.
YungTse Technology
@YungTseTech_twitter
I've declared mesage_tokens//2 multifile and dynamic within the object scope. I've given an implementation for component 'hello' that should be taking hello/1 and producing for it a list of tokens.
I'm calling print_message telling it to print an information message from component hello using hello/1.
?- {hello}.
% [ /home/michael/junk/hello.lgt loaded ]
% (0 warnings)
true.

?- hello::main.
% Unknown information message for component hello: hello('World')
true.
I'm just missing that step where it actually knows what component hello, or token hello/1 (it's unclear where the problem is) actually are.
Paulo Moura
@pmoura
Wrong order of the grammar rule arguments. Check documentation.
YungTseTech_twitter @YungTseTech_twitter facepalms.
YungTse Technology
@YungTseTech_twitter
Why do you flip them from print_message to message_tokens?
print_message is type, component, term while message_tokens is term, component.
Is this an indexing hack?
Paulo Moura
@pmoura
Yes, the order of arguments for the message tokens grammar rule is to take advantage of first-argument indexing.
YungTse Technology
@YungTseTech_twitter
As you may be guessing, I'm going over a bunch of old stuff I wrote and am making it Logtalk-ish in I/O now. :)
I'd hitherto been using write/writeln/nl.
Meta-messages can avoid the need of writing tokenization rules in common cases.
YungTse Technology
@YungTseTech_twitter
The Format-[Arguments] notation in tokens just forwards straight to the underlying format/3, right? So it's a point to watch out for unportable elements?
Paulo Moura
@pmoura
Correct.
YungTse Technology
@YungTseTech_twitter
Well, all my experiments are now done the Logtalk Way for output. Took a while to warm up to it, but now I don't actually mind it. :D I can see it being VERY good for i18n for starters.