[Feedback] Removing conversion from STRING_32 to STRING_8

4 messages Options
Embed this post
Permalink
Emmanuel Stapf

[Feedback] Removing conversion from STRING_32 to STRING_8

Reply Threaded More More options
Print post
Permalink
Hi,

A few years back when we introduced Unicode support in our libraries (mostly WEL
and Vision2, see http://s.eiffel.com/jhfqc), we decided to have an implicit
conversion from STRING_32 to STRING_8 (i.e. conversion with loss if the STRING_32
contains characters outside the CHARACTER_8 range) in order to not break existing
code. At the time, we said the conversion would be removed quickly. Five releases
later we still have the conversion.

We are planning on removing the conversion in the coming 6.5 release but before
doing so could you go at http://s.eiffel.com/yqogy and tell us what you think
about this removal?

Regards,
Manu

PS: you can try the effect of the conversion removal in your code by editing the
STRING_32 class and removing `as_string_8' from the list of conversion routines.

------------------------------------------------------------------------  
Eiffel Software
805-685-1006
http://www.eiffel.com       
Customer support: http://support.eiffel.com       
User group: http://groups.eiffel.com/join       
------------------------------------------------------------------------  



------------------------------------------------------------------------  
Eiffel Software
805-685-1006
http://www.eiffel.com       
Customer support: http://support.eiffel.com       
User group: http://groups.eiffel.com/join       
------------------------------------------------------------------------  
Peter Gummer-2

Re: [Feedback] Removing conversion from STRING_32 to STRING_8

Reply Threaded More More options
Print post
Permalink
Emmanuel Stapf [ES] wrote:

> PS: you can try the effect of the conversion removal in your code by  
> editing the
> STRING_32 class and removing `as_string_8' from the list of  
> conversion routines.

I just tried this in EiffelStudio 6.4. There are a few dozen errors in  
our code, which are easily fixed by adding '.as_string_8' in the right  
places.

But there are five errors in the i18n library, shown below.

- Peter Gummer


        2 VUAR(2): Non-conforming actual argument in feature call.
I18N_FILE_MANAGER.populate_file_lists (i18n.datasource) 114, 10
                Error code: VUAR(2)

Type error: non-conforming actual argument in feature call.
What to do: make sure that type of actual argument conforms to type
   of corresponding formal argument.

Class: I18N_FILE_MANAGER
Feature: populate_file_lists
Called feature: put (new: G; key: K) from HASH_TABLE
Argument name: new
Argument position: 1
Actual argument type: STRING_32
Formal argument type: STRING_8
Line: 114
                 locale_file_list.put(
->                  uri+Operating_environment.directory_separator.out+
                     temp.item,scope.get_locale)
        2 VUAR(2): Non-conforming actual argument in feature call.
I18N_FILE_MANAGER.populate_file_lists (i18n.datasource) 122, 10
                Error code: VUAR(2)

Type error: non-conforming actual argument in feature call.
What to do: make sure that type of actual argument conforms to type
   of corresponding formal argument.

Class: I18N_FILE_MANAGER
Feature: populate_file_lists
Called feature: put (new: G; key: K) from HASH_TABLE
Argument name: new
Argument position: 1
Actual argument type: STRING_32
Formal argument type: STRING_8
Line: 122
                 language_file_list.put (
->                  uri+Operating_environment.directory_separator.out+
                     temp.item,scope.get_language)
        2 VUAR(2): Non-conforming actual argument in feature call.
I18N_HOST_LOCALE_IMP.fill (i18n.locale.nls_imp) 99, 31
                Error code: VUAR(2)

Type error: non-conforming actual argument in feature call.
What to do: make sure that type of actual argument conforms to type
   of corresponding formal argument.

Class: I18N_HOST_LOCALE_IMP
Feature: fill
Called feature: set_ansi_code_page (a_value: [like ansi_code_page]  
detachable STRING_8) from I18N_CODE_PAGE_INFO
Argument name: a_value
Argument position: 1
Actual argument type: STRING_32
Formal argument type: detachable STRING_8
Line: 99
         Result.set_value_numbers_after_decimal_separator  
(get_value_numbers_after_decimal_separator)
->      Result.set_ansi_code_page (ansi_code_page)
         Result.set_oem_code_page (oem_code_page)
        2 VUAR(2): Non-conforming actual argument in feature call.
I18N_HOST_LOCALE_IMP.fill (i18n.locale.nls_imp) 100, 30
                Error code: VUAR(2)

Type error: non-conforming actual argument in feature call.
What to do: make sure that type of actual argument conforms to type
   of corresponding formal argument.

Class: I18N_HOST_LOCALE_IMP
Feature: fill
Called feature: set_oem_code_page (a_value: [like oem_code_page]  
detachable STRING_8) from I18N_CODE_PAGE_INFO
Argument name: a_value
Argument position: 1
Actual argument type: STRING_32
Formal argument type: detachable STRING_8
Line: 100
         Result.set_ansi_code_page (ansi_code_page)
->      Result.set_oem_code_page (oem_code_page)
         Result.set_mac_code_page (mac_code_page)
        2 VUAR(2): Non-conforming actual argument in feature call.
I18N_HOST_LOCALE_IMP.fill (i18n.locale.nls_imp) 101, 30
                Error code: VUAR(2)

Type error: non-conforming actual argument in feature call.
What to do: make sure that type of actual argument conforms to type
   of corresponding formal argument.

Class: I18N_HOST_LOCALE_IMP
Feature: fill
Called feature: set_mac_code_page (a_value: [like mac_code_page]  
detachable STRING_8) from I18N_CODE_PAGE_INFO
Argument name: a_value
Argument position: 1
Actual argument type: STRING_32
Formal argument type: detachable STRING_8
Line: 101
         Result.set_oem_code_page (oem_code_page)
->      Result.set_mac_code_page (mac_code_page)
       end

Peter Gummer-2

Re: [Feedback] Removing conversion from STRING_32 to STRING_8

Reply Threaded More More options
Print post
Permalink
Yesterday I wrote:

> But there are five errors in the i18n library, shown below.

On closer inspection of the errors in our EiffelStudio 6.4 project,  
I've noticed a couple of things:

1. EiffelVision has some errors too, shown below.

2. Some of the errors in our code look like possible bugs where we are  
converting a 32-bit Unicode string to a STRING_8, which we then  
immediately display in an EiffelVision widget. Doesn't sound like the  
right thing to do, does it? Eliminating this particular conversion  
seems to be a wise move.

- Peter Gummer


        2 VJAR: Source of assignment does not conform to target.
EV_ENVIRONMENT.font_families_8 (interface) 74, 5
                Error code: VJAR

Type error: source of assignment does not conform to target.
What to do: make sure that type of source (right-hand side)
   conforms (in the sense of inheritance rule) to type of target.

Class: EV_ENVIRONMENT
Feature: font_families_8
Target name: l_family
Target type: STRING_8
Source type: STRING_32
Line: 74
         loop
->        l_family := l_list.item
           if l_family.is_valid_as_string_8 then
        2 VJAR: Source of assignment does not conform to target.
EV_FRAME.default_identifier_name (interface) 76, 5
                Error code: VJAR

Type error: source of assignment does not conform to target.
What to do: make sure that type of source (right-hand side)
   conforms (in the sense of inheritance rule) to type of target.

Class: EV_FRAME
Feature: default_identifier_name
Target name: Result
Target type: STRING_8
Source type: STRING_32
Line: 76
         else
->        Result := text.twin
           Result.to_lower
        2 VJAR: Source of assignment does not conform to target.
EV_MESSAGE_DIALOG.default_identifier_name (interface) 175, 5
                Error code: VJAR

Type error: source of assignment does not conform to target.
What to do: make sure that type of source (right-hand side)
   conforms (in the sense of inheritance rule) to type of target.

Class: EV_MESSAGE_DIALOG
Feature: default_identifier_name
Target name: Result
Target type: STRING_8
Source type: STRING_32
Line: 175
         else
->        Result := title.as_lower
           Result.prune_all ('.')
        2 VJAR: Source of assignment does not conform to target.
EV_BUTTON.default_identifier_name (interface) 83, 5
                Error code: VJAR

Type error: source of assignment does not conform to target.
What to do: make sure that type of source (right-hand side)
   conforms (in the sense of inheritance rule) to type of target.

Class: EV_BUTTON
Feature: default_identifier_name
Target name: Result
Target type: STRING_8
Source type: STRING_32
Line: 83
         else
->        Result := text.as_lower
           Result.prune_all ('.')
        2 VJAR: Source of assignment does not conform to target.
EV_MENU_ITEM.default_identifier_name (interface) 86, 5
                Error code: VJAR

Type error: source of assignment does not conform to target.
What to do: make sure that type of source (right-hand side)
   conforms (in the sense of inheritance rule) to type of target.

Class: EV_MENU_ITEM
Feature: default_identifier_name
Target name: Result
Target type: STRING_8
Source type: STRING_32
Line: 86
         else
->        Result := text.twin
           Result.prune_all ('&')

Emmanuel Stapf

RE: [Feedback] Removing conversion from STRING_32 to STRING_8

Reply Threaded More More options
Print post
Permalink
Thanks Peter for highlighting this. Clearly we have to do our own homework and
this shows that everyone is at the same level when it comes to breaking changes.

Regards,
Manu

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Peter Gummer
> Sent: Saturday, September 26, 2009 5:59 PM
> To: [hidden email]
> Subject: Re: [eiffel_software] [Feedback] Removing conversion from
> STRING_32 to STRING_8
>
> Yesterday I wrote:
>
> > But there are five errors in the i18n library, shown below.
>
> On closer inspection of the errors in our EiffelStudio 6.4 project,
> I've noticed a couple of things:
>
> 1. EiffelVision has some errors too, shown below.
>
> 2. Some of the errors in our code look like possible bugs where we are
> converting a 32-bit Unicode string to a STRING_8, which we then
> immediately display in an EiffelVision widget. Doesn't sound like the
> right thing to do, does it? Eliminating this particular conversion
> seems to be a wise move.
>
> - Peter Gummer
>
>
> 2 VJAR: Source of assignment does not conform to target.
> EV_ENVIRONMENT.font_families_8 (interface) 74, 5
> Error code: VJAR
>
> Type error: source of assignment does not conform to target.
> What to do: make sure that type of source (right-hand side)
>    conforms (in the sense of inheritance rule) to type of target.
>
> Class: EV_ENVIRONMENT
> Feature: font_families_8
> Target name: l_family
> Target type: STRING_8
> Source type: STRING_32
> Line: 74
>          loop
> ->        l_family := l_list.item
>            if l_family.is_valid_as_string_8 then
> 2 VJAR: Source of assignment does not conform to target.
> EV_FRAME.default_identifier_name (interface) 76, 5
> Error code: VJAR
>
> Type error: source of assignment does not conform to target.
> What to do: make sure that type of source (right-hand side)
>    conforms (in the sense of inheritance rule) to type of target.
>
> Class: EV_FRAME
> Feature: default_identifier_name
> Target name: Result
> Target type: STRING_8
> Source type: STRING_32
> Line: 76
>          else
> ->        Result := text.twin
>            Result.to_lower
> 2 VJAR: Source of assignment does not conform to target.
> EV_MESSAGE_DIALOG.default_identifier_name (interface) 175, 5
> Error code: VJAR
>
> Type error: source of assignment does not conform to target.
> What to do: make sure that type of source (right-hand side)
>    conforms (in the sense of inheritance rule) to type of target.
>
> Class: EV_MESSAGE_DIALOG
> Feature: default_identifier_name
> Target name: Result
> Target type: STRING_8
> Source type: STRING_32
> Line: 175
>          else
> ->        Result := title.as_lower
>            Result.prune_all ('.')
> 2 VJAR: Source of assignment does not conform to target.
> EV_BUTTON.default_identifier_name (interface) 83, 5
> Error code: VJAR
>
> Type error: source of assignment does not conform to target.
> What to do: make sure that type of source (right-hand side)
>    conforms (in the sense of inheritance rule) to type of target.
>
> Class: EV_BUTTON
> Feature: default_identifier_name
> Target name: Result
> Target type: STRING_8
> Source type: STRING_32
> Line: 83
>          else
> ->        Result := text.as_lower
>            Result.prune_all ('.')
> 2 VJAR: Source of assignment does not conform to target.
> EV_MENU_ITEM.default_identifier_name (interface) 86, 5
> Error code: VJAR
>
> Type error: source of assignment does not conform to target.
> What to do: make sure that type of source (right-hand side)
>    conforms (in the sense of inheritance rule) to type of target.
>
> Class: EV_MENU_ITEM
> Feature: default_identifier_name
> Target name: Result
> Target type: STRING_8
> Source type: STRING_32
> Line: 86
>          else
> ->        Result := text.twin
>            Result.prune_all ('&')
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>

------------------------------------------------------------------------  
Eiffel Software
805-685-1006
http://www.eiffel.com       
Customer support: http://support.eiffel.com       
User group: http://groups.eiffel.com/join       
------------------------------------------------------------------------