(bord effect à side effect)
Your point seems to be correct. But I would be wary of introducing hidden performance hits that might affect lots of existing software. I can already see the complaints.
My guess is that EiffelBase has other cases deserving criticism, from a correctness perspective, in EiffelBase. For a revised version of the library that is entirely designed for correctness, and has been fully proved correct, it is worthwhile looking into EiffelBase 2.
But you are right, descendants of LINEAR in EiffelBase should take care to redefine linear_representation.
-- BM
-----Original Message-----
From: eiffel...@googlegroups.com [mailto:eiffel...@googlegroups.com] On Behalf Of Jacques Silberstein
Sent: Friday, March 16, 2018 20:10
To: eiffel...@googlegroups.com
Subject: [eiffel-users] Who to qualify this ?
Who to qualify this ?
From class LINEAR
linear_representation: LINEAR [G]
-- Representation as a linear structure
do
Result := Current
end
Most descendant doesn't redefine that feature. But from CONTABLE_SEQUENCE the implementation of index is an INTEGER attribute.
This make that any client of a linear_representation manipulate the supplier of that representation it-self. And in general move the cursor. This is a well masked [side] effect. And, the client thing that has no consequences while this is just a representation !
I thing, one should replace that by:
linear_representation: LINEAR [G]
--
Representation as a linear structure
do
Result := twin
end
--
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.
Visit this group at https://groups.google.com/group/eiffel-users.
For more options, visit https://groups.google.com/d/optout.
as_unicode (utf_8: STRING; keeping_ref: BOOLEAN): READABLE_STRING_GENERAL
-- returns `utf_8' string as unicode
-- when keeping a reference to `Result' specify `keeping_ref' as `True'
local
str_32: STRING_32
do
if is_single_byte_utf_8 (utf_8) then
Result := utf_8
else
str_32 := Unicode_buffer
str_32.wipe_out
utf_8_string_8_into_string_32 (utf_8, str_32)
Result := str_32
end
if keeping_ref then
Result := Result.twin
end
end