Archived

This forum has been archived. Please start a new discussion on GitHub.

Slice can support generic definition?

Slice can support generic definition?

like this:
sequence<T> seqtype;

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Ice doesn't support generic definitions, not many languages support the concept of generics... What is your use case for generics?

    Cheers,
    Benoit.
  • Benoit, thanks!

    I use

    sequence<string> seqstring;
    ["clr:generic:List"] sequence<seqstring> dataset;

    to fetch the resultset(many oracle procedure return) from server!

    but in client, I must convert the string list to entity string. I think, if slice support generic, I'll not define so many struct in slice, in addition, the client can receive the entity list directly.

    excuse me for my poor english!
  • benoit
    benoit Rennes, France
    Hi,

    Hmm, it's still not totally clear to me what you're trying to do. What is an "entity"? Perhaps you could show a bit more of your Slice types?

    Did you consider using classes instead of structs? Your Slice methods could transfer sequence of objects if you don't want to re-define a sequence types for each type of object, for example:
    class Entity {
    };
    sequence<Entity> EntitySeq;
    
    class MyEntity extends Entity {
    };
    class MyEntity2 extends Entity {
    };
    

    Cheers,
    Benoit.