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 

Silverfrost FTN95 and .Net Generics

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



Joined: 20 Apr 2011
Posts: 75
Location: Australia

PostPosted: Wed Apr 27, 2011 12:34 am    Post subject: Silverfrost FTN95 and .Net Generics Reply with quote

Hello,

I am working on upgrading a FTN95 console application to a GUI application, so my basic plan of attack is to turn the FTN95 application into a DLL and reference it in a .Net 4.0 project.

This application used to read in large XML files and use the data as its paramaters, however I am now looking at using LINQ-XSD and passing the resulting class directly to FTN95 and having it parse the data in the class in memory instead of reading a file.

Can anyone tell me about issues I might run into with this approach?

However when I pass this class directly to FTN95 there are some issues with generic type arrays for example (List<T>), where whenever I try to access their members in my FTN95 the compiler simply throws an error and says the field does not exist.

Is there anyway to use generics in FTN95 code.. ambiguously?

Also I was wondering what the easiest way to parse a .Net array in FTN95 is? and if it is possible? If not would creating a .Net extensions library for FTN95 to use be a recommended solution? And could I use a .Net extensions library to throw detailed exceptions from within FTN95 code?

Thanks,
Alex.

UPDATE: I ended up using non-generic arrays on the .NET side which can be more difficult to work with and may result in some memory pressure when converting these arrays to dynamically sized ones so this solution is not ideal and can add unexpected performance pressures when trying to integrate with an FTN codebase.


Last edited by alex21 on Fri Jun 21, 2019 7:49 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
alex21



Joined: 20 Apr 2011
Posts: 75
Location: Australia

PostPosted: Fri Jun 21, 2019 5:16 am    Post subject: Reply with quote

Why did I never get a reply to this? It is not mentioned in the documentation and is a real stuff around for anyone just expecting .NET integration to work in any normal fashion.
Back to top
View user's profile Send private message MSN Messenger
PaulLaidler
Site Admin


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

PostPosted: Fri Jun 21, 2019 6:46 am    Post subject: Reply with quote

My .NET FTN95 and C# skills are a little rusty. The only thing that I can suggest is that if FTN95 is failing then you could try posting a simple demonstrator and ask for it to be fixed.

The only general point that I would make and may be relevant is that parts of .NET FTN95 use salflibc.dll so in this sense .NET FTN95 is not portable to other operating systems.
Back to top
View user's profile Send private message AIM Address
alex21



Joined: 20 Apr 2011
Posts: 75
Location: Australia

PostPosted: Fri Jun 21, 2019 7:25 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
My .NET FTN95 and C# skills are a little rusty. The only thing that I can suggest is that if FTN95 is failing then you could try posting a simple demonstrator and ask for it to be fixed.

The only general point that I would make and may be relevant is that parts of .NET FTN95 use salflibc.dll so in this sense .NET FTN95 is not portable to other operating systems.


Thank you for your reply, I have included code in this post: http://forums.silverfrost.com/viewtopic.php?t=4025

It is hosted in a public github repo so you should be able to download/view the code from the browser.
Back to top
View user's profile Send private message MSN Messenger
PaulLaidler
Site Admin


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

PostPosted: Fri Jun 21, 2019 8:43 am    Post subject: Reply with quote

alex21

I was thinking of something simpler and more direct. It would take me at least an hour to identify the issue from all of this information.
Back to top
View user's profile Send private message AIM Address
Robert



Joined: 29 Nov 2006
Posts: 444
Location: Manchester

PostPosted: Fri Jun 21, 2019 9:36 am    Post subject: Reply with quote

There isn't any support for generics in FTN95
Back to top
View user's profile Send private message Visit poster's website
alex21



Joined: 20 Apr 2011
Posts: 75
Location: Australia

PostPosted: Fri Jun 21, 2019 10:05 am    Post subject: Re: Reply with quote

Robert wrote:
There isn't any support for generics in FTN95


Is this stated anywhere in the documentation? I found this page: https://www.silverfrost.com/ftn95-help/netprog/supportedfeatures.aspx

But all the links at the top are broken, but it says that generic names are supported for arguments and interfaces whatever that means...

Essentially what is the difference between a generic type and a non-generic type that makes it different from any other type? It really seems like a naming thing because I have updated my example on github to show simply giving a generic type a concrete name compiles fine, so what is it about long random ass generic type names you can't support? Because in a project with a .NET domain where I can't go in and wrap every generic type with a concrete name, its not practical and reflection has performance issues that I should be able to avoid...

Code:

! Initialize the dataType
    dataType = NEW@("Domain.DataType")

    ! Simple integration syntax won't work for generic types...... Won't even compile, need to wrap it as a non-generic type for it to work directly
    ! even though it implements non-generic interfaces (IList) with the same name as the member I am trying to access...
    !c = dataType%DataList%Count

    ! But simply wrapping the generic type, which is essentially just a type with a really random name (is it some kind of naming issue?!)
    ! given the concrete name of StringList... will compile... so generic type names are not supported why?
    c = dataType%WrappedDataList%Count


Code:

public class DataType
    {
        public List<string> DataList
        {
            get;
            set;
        }

        public StringList WrappedDataList
        {
            get;
            set;
        }

        .....

        public DataType()
        {
            DataList = new List<string>() { "hello", "this", "is", "a", "test" };
            WrappedDataList = new StringList() { "hello", "this", "is", "a", "test" };
            .....
        }
    }


https://github.com/alexhopeoconnor/ftn_generic_collections_example


Last edited by alex21 on Fri Jun 21, 2019 10:10 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Robert



Joined: 29 Nov 2006
Posts: 444
Location: Manchester

PostPosted: Fri Jun 21, 2019 10:10 am    Post subject: Reply with quote

I need to have a look at it again.
Back to top
View user's profile Send private message Visit poster's website
alex21



Joined: 20 Apr 2011
Posts: 75
Location: Australia

PostPosted: Fri Jun 21, 2019 10:13 am    Post subject: Re: Reply with quote

Robert wrote:
I need to have a look at it again.


Thank you, will improve performance/remove boilerplate requirements in some of my projects and let me know if I can help but giving any more examples or anything.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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