| Result.extend (({SEQUENCE [INTERVAL [DATE]]}).type_id) |
| if attached {SEQUENCE[ANY]} eif_container_obj as eif_seq then |
| att_static_cont_item_tid := attached_type (generic_dynamic_type (eif_container_obj, 1)) -- obtain type id of gen parm 1 |
Instead of trying to convert everything to attached type which are problematic since it is highly dependent on the version of the compiler you are using, you should instead rely on the detachable version of types. Granted this is not what you would like but it is the only solution that will work with the old versions of the compiler and the future ones.
Also look at the precondition of `{REFLECTED_OBJECT}.set_reference_field’, it will give you all you need to find out if a type matches the type of a field, the key here is to use `field_conforms_to’.
As for matching SEQUENCE [INTERVAL [DATE]] with the variations of the type, you actually only care about matching against the attached or detachable version of the type. The nature of the attachment of the actual generic parameter should not matter and it is fully working as of today.
Regards,
Mnau
--
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 eiffel-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
dynamic_hash_item_type := generic_dynamic_type (a_hash_table, 1)
if is_dt_primitive_atomic_type (dynamic_hash_item_type) then
...
elseif is_dt_primitive_sequence_conforming_type (dynamic_hash_item_type) then
... etc
Result := dt_primitive_atomic_types.has (attached_type (a_type_id))
dt_primitive_atomic_types: ARRAYED_LIST [INTEGER]
-- all primitive atomic types used in DT structures
once
create Result.make (0)
Result.extend (({NATURAL_8}).type_id)
Result.extend (({NATURAL_16}).type_id)
Result.extend (({NATURAL_32}).type_id)
Result.extend (({NATURAL_64}).type_id)
Result.extend (({INTEGER_8}).type_id)
Result.extend (({INTEGER_16}).type_id)
Result.extend (({INTEGER_32}).type_id)
Result.extend (({INTEGER_64}).type_id)
Result.extend (({REAL_32}).type_id)
Result.extend (({REAL_64}).type_id)
Result.extend (({BOOLEAN}).type_id)
Result.extend (({CHARACTER_8}).type_id)
Result.extend (({CHARACTER_32}).type_id)
Result.extend (({STRING_8}).type_id)
Result.extend (({STRING_32}).type_id)
Result.extend (({DATE}).type_id)
Result.extend (({DATE_TIME}).type_id)
Result.extend (({TIME}).type_id)
Result.extend (({DATE_TIME_DURATION}).type_id)
Result.extend (({ISO8601_DATE}).type_id)
Result.extend (({ISO8601_DATE_TIME}).type_id)
Result.extend (({ISO8601_TIME}).type_id)
Result.extend (({ISO8601_DURATION}).type_id)
Result.extend (({TERMINOLOGY_CODE}).type_id)
Result.extend (({URI}).type_id)
endIndeed nothing changes for .NET, so previous workarounds still have to be applied.
Manu
--
I would drop the `attached_type’ in the implementation of is_dt_primitive_atomic_type because the ID you will get from querying directly the actual generic parameter type from the HASH_TABLE will carry the proper attachment mark. Now if you can have detachable type for items, then make sure to add the detachable version of the reference types in your `dt_primitive_atomic_types’ table, i.e.
Result.extend (({STRING_8}).type_id)
Result.extend (({detachable STRING_8}).type_id)
Regards,
Manu
I would drop the `attached_type’ in the implementation of is_dt_primitive_atomic_type because the ID you will get from querying directly the actual generic parameter type from the HASH_TABLE will carry the proper attachment mark.
Now if you can have detachable type for items, then make sure to add the detachable version of the reference types in your `dt_primitive_atomic_types’ table, i.e.
Result.extend (({STRING_8}).type_id)
Result.extend (({detachable STRING_8}).type_id)
Here is the code I suggested you to write to replace `attached_type’ in REFLECTOR while waiting for a fix:
is_attached_type (a_type_id: INTEGER): BOOLEAN
-- Is `a_type_id' an attached type?
require
a_type_non_negative: a_type_id >= 0
do
if type_of_type (a_type_id).is_expanded then
Result := True
else
Result := {ISE_RUNTIME}.is_attached_type (a_type_id)
end
end
attached_type (type_id: INTEGER): INTEGER
-- Attached version of `type_id'.
require
type_id_nonnegative: type_id >= 0
do
if type_of_type (type_id).is_expanded then
Result := type_id
else
Result := {ISE_RUNTIME}.attached_type (type_id)
end
ensure
unchanged_if_attached: is_attached_type (type_id) implies type_id = Result
end
Did you try that? If so and it doesn’t work, the error is somewhere else.
Regards,
Manu
From: Thomas Beale [mailto:wolan...@gmail.com]
Sent: Thursday, January 07, 2016 08:02
To: Eiffel Users <eiffel...@googlegroups.com>
Cc: ma...@eiffel.com
Subject: Re: [eiffel-users] Easiest way to do type comparisons?
I've been looking at the code. There are around 1,500 lines of code affected, and in fact, a pretty high dependence on using type ids rather than testing types of objects.