string as string_n

9 views
Skip to first unread message

r...@amalasoft.com

unread,
Jun 23, 2019, 10:57:13 AM6/23/19
to Eiffel Users Group
I don't remember, and can't seem to find, how one goes about setting "STRING" to mean either STRING_8 or STRING_32.
I created a new hello_world project and, though it didn't ask, it seems to equate STRING to STRING_8 (as evidenced by things like "out" in ANY). 
When I try to enter "STRING" in the Class field, it gives me the add-a-class dialog, so it certainly doesn't think it's an actual class, but when I look at the text of ANY, the type signatures are STRING, and when I retarget to STRING, it comes up as STRING_8.
So, it's clear there is mapping going on, but where, and how does one configure/control that?

Thanks
R

Germán Arias

unread,
Jun 23, 2019, 7:43:41 PM6/23/19
to eiffel...@googlegroups.com

Hi,

Not sure if I understand your question at all. But you can explicitly tell the compiler when a string is STRING_32 or should be converted to STRING_32. For example:

{STRING_32} "Hello world"

or

{STRING_32} some_thing.out

Many features uses STRING_8. So if you later uses this string whit some features that expect STRING_8, this will be converted and you can lose information (Characters that can't be displayed with STRING_8). For example "print" expect STRING_8. If you want display the string as STRING_32 you should use "localized_print" available at library "encoding".

Germán

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/20190623075638.cf48dd763fcaf5d42559c6c92f6fc53b.c4b99f7ca6.wbe%40email25.godaddy.com.
For more options, visit https://groups.google.com/d/optout.

Jocelyn Fiat

unread,
Jun 24, 2019, 4:57:16 AM6/24/19
to Eiffel Users
There is a mapping, i.e STRING = STRING_8, same as REAL=REAL32, INTEGER=INTEGER_32 , ...


<mapping old_name="STRING" new_name="STRING_8"/>

Regards,
-- Jocelyn


For more options, visit https://groups.google.com/d/optout.


--
Jocelyn
------------------------------------------------------------------------
Eiffel Software
https://www.eiffel.com
Customer support: https://support.eiffel.com
User group: https://groups.google.com/forum/#!forum/eiffel-users
------------------------------------------------------------------------

Jocelyn Fiat

unread,
Jun 24, 2019, 4:58:41 AM6/24/19
to Eiffel Users

Gachoud Philippe

unread,
Jun 24, 2019, 7:04:31 AM6/24/19
to eiffel...@googlegroups.com
Hi,

may I ask why this mapping is done with old as STRING and new as STRING_8? what is the semantic of that?

Thx


For more options, visit https://groups.google.com/d/optout.


--
**********************************************
Philippe Gachoud
Puerto Williams 6657
Las Condes
Santiago de Chile
+56 934022210
ph.ga...@gmail.com
**********************************************

r...@amalasoft.com

unread,
Jun 24, 2019, 7:59:09 AM6/24/19
to eiffel...@googlegroups.com
I'll check 'em out.  Thanks!
R
-------- Original Message --------
Subject: Re: [eiffel-users] string as string_n
From: Jocelyn Fiat <jf...@eiffel.com>
Date: Mon, June 24, 2019 4:58 am
To: Eiffel Users <eiffel...@googlegroups.com>


r...@amalasoft.com

unread,
Jun 24, 2019, 8:00:53 AM6/24/19
to eiffel...@googlegroups.com
Not quite the answer to my question, but very helpful and clear.
Thanks

Jocelyn Fiat

unread,
Jun 24, 2019, 1:11:35 PM6/24/19
to Eiffel Users
Not sure about the historical reason to choose those names.
But I think initially it was used to help with refactoring and renaming, for instance, old name WIDE_CHARACTER was renamed as new CHARACTER_32.
So code could use new class name, but also old class name for existing code. Note the IDE will suggest new name during completion and related tools.

It could also have been "alias" -> "type_name" ...
but it is "old" -> "new"


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages