[eiffel-users] Querying the type of a list item for a non-generic class

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[eiffel-users] Querying the type of a list item for a non-generic class

Finnian Reilly

Does anyone know how to query the item type of string list which is not generic but inherits a generic list as for example

class STRING_LIST

inherit ARRAYED_LIST
[STRING]

create
   make

end

This code will not work
local
   str_list
: STRING_LIST
   list
: LIST [STRING_GENERAL]
   type TYPE
[ANY]
do
   create str_list
.make (0)
   list
:= str_list
   type
:= list.generating_type.generic_parameter_type (1)
end

And it's possible the list might be empty so you can't query the type of the first item

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [eiffel-users] Querying the type of a list item for a non-generic class

'Alexander Kogtenkov' via Eiffel Users
I'm afraid this information in unavailable at run-time.

Alexander Kogtenkov


Finnian Reilly <[hidden email]>:


Does anyone know how to query the item type of string list which is not generic but inherits a generic list as for example

class STRING_LIST

inherit ARRAYED_LIST
[STRING]

create
   make

end

This code will not work
local
   str_list
: STRING_LIST
   list
: LIST [STRING_GENERAL]
   type TYPE
[ANY]
do
   create str_list
.make (0)
   list
:= str_list
   type
:= list.generating_type.generic_parameter_type (1)
end

And it's possible the list might be empty so you can't query the type of the first item

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
Loading...