Showing calls from an internal function

0 votes
asked Feb 22 in Question / help by anonymous
I want to depict something like

    A::foo() { //public API
        internal();
    }
    
    A::internal() {
        B.bar()
    }

So I tried

    ->A: foo()
    A -> A :internal()
    A -> B :bar()

But I end up with something like

         ,-.             ,-.      
         |A|             |B|      
         `+'             `+'      
     foo()|               |       
     ----->               |       
          |               |       
          |----.                  
          |    | internal()       
          |<---'                  
          |               |       
          |     bar()     |       
          | -------------->       
         ,+.             ,+.      
         |A|             |B|      
         `-'             `-'    

Which rather ends up denoting that `bar()` is invoked *after* completion of `internal`. How do I get the call to `bar()` to show up from *within* `internal()`?

1 Answer

0 votes
answered Feb 23 by Martin (8,280 points)
edited Feb 23 by Martin

Well my joke(*) answer is this: 
(*) because I'm not sure if it is a feature or a bug!

click diagram for online server

But a better way is perhaps to use lifelines:

click diagram for online server

commented Feb 24 by anonymous
Your diagram actually doesn't look that bad if change it to ...

@startuml
!pragma teoz true
    ->A: foo()     
A -> B :\t\tbar()
&   A <- A :internal()
@enduml
commented Feb 24 by Martin (8,280 points)

Nice idea, I didn't think of that.  For other people following this thread, the refinement looks like this:

...