Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7801265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:53:36+00:00 2026-06-02T00:53:36+00:00

I have two routines whose difference is only in the order of arguments, but

  • 0

I have two routines whose difference is only in the order of arguments, but I would like to use them through an interface, so that the proper one is invoked according to the order of the arguments when invoked. The compiler complains that it cannot distinguish them, and my guess is because if I use the syntax for named arguments at call, it won’t know which one to call. One workaround would be to use different names for the arguments, but I was wondering if there’s a way to disable named argument call style.

Example, this is the situation I am trying to handle

module Foo

    interface Bar
        module procedure Bar1
        module procedure Bar2
    end interface

contains
    subroutine Bar1(i,r)
        integer, intent(in) :: i
        real, intent(in) :: r
        print *, "bar1"
    end subroutine
    subroutine Bar2(r,i)
        real, intent(in) :: r
        integer, intent(in) :: i
        print *, "bar2"
    end subroutine

end module

program fuux
    use Foo
    integer :: i
    real :: r

    r = 5.0
    i = 3

    call Bar(i,r) ! note that if I call Bar(i=i, r=r) the compiler cannot disambiguate
                  ! so it will complain at the interface statement
end program
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:53:37+00:00Added an answer on June 2, 2026 at 12:53 am

    I do not know of any way to do what you suggest, or rather to do what I think you are suggesting in the phrase ‘disable named argument call style’. If this answer infuriates, disappoints or displeases in any way, post some code and we (SO I mean, I have not too many airs and graces and rarely use the royal ‘we’) might be able to suggest a cunning trick which will please you.

    EDIT

    No direct way to do what you want to do springs to mind. The first workround that occurs to me is to define a subroutine called bar which takes the series of arguments in a canonical order and simply calls bar1, bar2 (and any other baby bars you care to define) with the arguments in the appropriate order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two stored procedures I wish to use in my stored procedure, but
I have a class with two methods defined in it. public class Routines {
I have the following two routines in Flash Builder: public function getData():void { httpService
I have two goroutine like, Routine 1 { // do something } Routine 2
I have two interrupt service routines (ISR) which basically do the exact same thing
I have two matrices x and y, both are results from different algorithms/routines that
Have two folders with approx. 150 java property files. In a shell script, how
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two DropDownListBoxes one is called ddlDay and the other is ddlMonth. As
I have two application that need to talk to each other. App1 needs to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.