Say I am programming a card game in fortran. I have a card object, with a type-bound procedure "getsuit" and a deck object (consisting of an array of cards) with a type-bound procedure "getcard".
What I'd like is to be able to do something of the form:
deck%getcard%getsuit
When I do this, however, my compiler informs me that "a function reference cannot be used as the leftmost part-ref of a structure component," even if the function is of type "card." On the other hand, doing this:
card = deck%getcard
card%getsuit
works fine. It seems obnoxious to have to use two lines and an extra variable to accomplish this; is there any way around it?