- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use a homebrew QSort in two distinct fashions, to sort a collection of objects or to create an ordered set of indices into that collection.
The syntax I would like to use is
Call Sort( ItemVector )
for the former, and
List = Sort( ItemVector )
for the later. I have included both forms in a module and defined the interface for the generic routine with these two as module procedures, in the order above. I get an error when I compile a program which uses the later syntax. It appears that the compiler (CVF6.6c) can't distinguish these two and correctly choose the later module procedures.
"Error: A function reference is invoking an external subroutine subprogram. "
Why can't the compiler detect the usage in an assignment and qualify the signature of a call in order to resolve between these two properly?
If this is fundamentally impossible, why don't I get an error when I compile the Sort module itself?
Thanks
The syntax I would like to use is
Call Sort( ItemVector )
for the former, and
List = Sort( ItemVector )
for the later. I have included both forms in a module and defined the interface for the generic routine with these two as module procedures, in the order above. I get an error when I compile a program which uses the later syntax. It appears that the compiler (CVF6.6c) can't distinguish these two and correctly choose the later module procedures.
"Error: A function reference is invoking an external subroutine subprogram. "
Why can't the compiler detect the usage in an assignment and qualify the signature of a call in order to resolve between these two properly?
If this is fundamentally impossible, why don't I get an error when I compile the Sort module itself?
Thanks
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Generic resolution does not distinguish based on subroutine/function alone. I tried an example with a subroutine and function both with the same argument list and CVF did complain. Can you attach an example showing the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not very easily, since there are at least four files necessary. Interestingly, I tried to create the smallest possible example of the problem and on it I get a error complaining " Error: The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name."
That is what I would have expected for consistency, but leaves the question why the compiler can't use context (assignment) as part of the "signature".
I'm going to zip up the full module and include files so you can try it.
That is what I would have expected for consistency, but leaves the question why the compiler can't use context (assignment) as part of the "signature".
I'm going to zip up the full module and include files so you can try it.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page