forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Abstract Interface

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions
View previous topic :: View next topic  
Author Message
simon



Joined: 05 Jul 2006
Posts: 314

PostPosted: Thu Dec 18, 2025 11:23 pm    Post subject: Abstract Interface Reply with quote

Is it easy to get FTN95 to support ABSTRACT INTERFACE? Blame ChatGPT for the request - it is making some suggestions to "improve" my code! I have just had it help me solve a long-term ClearWin+ problem so I'm giving it a bit more credibility than I would have done a little while back.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8320
Location: Salford, UK

PostPosted: Fri Dec 19, 2025 8:41 am    Post subject: Reply with quote

"abstract interface" is already supported, at least in some contexts.

See for example \Program Files (x86)\Silverfrost\FTN95\source64\clrwin.f95.

Please let us know if there are valid contexts where it is not supported.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1943
Location: USA

PostPosted: Fri Dec 19, 2025 11:24 am    Post subject: Reply with quote

Here is an example, which Gfortran 13.4 accepts:
Code:

MODULE abstr_int
implicit none

ABSTRACT INTERFACE
   function fun_2_args(x, y)
integer,parameter:: dp=kind(0.d0)
   real(dp) :: fun_2_args
   real(dp), intent(in) :: x, y
   end function fun_2_args
END INTERFACE

INTERFACE
   module function fun1(x,y)
integer,parameter:: dp=kind(0.d0)
    real(dp) :: fun1
   real(dp), intent(in) :: x, y
   end function fun1
!***
   module function fun2(x,y)
integer,parameter:: dp=kind(0.d0)
   real(dp) :: fun2
   real(dp), intent(in) :: x, y
   end function fun2
END INTERFACE
END MODULE abstr_int

For this code, FTN95 says:
ERROR S:\absi.F90 13: MODULE cannot appear in a INTERFACE block
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8320
Location: Salford, UK

PostPosted: Fri Dec 19, 2025 1:35 pm    Post subject: Reply with quote

mecej4

Thank you for the feedback. I have logged this for investigation.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 314

PostPosted: Sat Dec 20, 2025 8:21 am    Post subject: Reply with quote

It is great to see Abstract Interface available. I did find one problem. In the program below, FTN95 compiles with an error message stating that cbf0 is undefined. The error message goes away if Only is not used.

Code:
! FTN95 does not recognise cbf0, but does if Only is removed
Module m1
   Public :: cbf0
   Abstract Interface
      Integer Function cbf0()
      End Function cbf0
   End Interface
End Module m1
Module m2
   Use m1, Only: cbf0
Contains
   Integer Function cbf( f1 )
      Procedure(cbf0) :: f1
   End Function cbf
End Module m2
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8320
Location: Salford, UK

PostPosted: Sat Dec 20, 2025 8:44 am    Post subject: Reply with quote

mecej4

I suspect that MODULE FUNCTIONs are only meaningful when used with SUBMODULEs. At the moment FTN95 does not support SUBMODULEs and this is likely to be a significant undertaking (given the intrinsic complexity of MODULEs). Maybe something for 2026.

simon

Thank you for the bug report. It appears that at the moment you can't USE an ABSTRACT INTERFACE it has to be copyied to the place where it is used.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Suggestions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group