Comparing CLR strings and Ruby strings - a slightly surprising behaviour

Back ticks have a different meaning in ruby. They denote code to be
executed
on the system shell.
– henon

On Thu, Mar 5, 2009 at 10:21 PM, Pete Bacon D. <

Ruby uses back-ticks for shell strings, so it doesn’t seem to be more
obvious that the value is CLR string.
I agree it’s not blatant. It’s a small hint that should help you to
distinguish the types. CLR strings will have most of the methods Ruby
string have (except for mutable ones) so the difference is not so
important in most scenarios.

Tomas

I like backticks more than single quotes, but ideally you’d just have
the
same quotes and make them red or something for clr strings.

On Fri, Mar 6, 2009 at 10:21 AM, Pete Bacon D. <

Wouldn’t using different syntax especially for clr just amount to
creating a new language instead of implementing Ruby on the dlr? (Not
to mention a language that’s not very intuitive)

This is not about syntax. This is just what System::String#inspect
prints out.

Tomas

Well, it slightly relates to syntax … because basic ruby types
(string,
numeric, array, hash, range, etc.) use to print valid ruby syntax on
inspect. This is very useful for reinterpreting values stored as strings
by
the use of inspect.
– henon

On Fri, Mar 6, 2009 at 7:04 AM, Tomas M.
<[email protected]

Syste::String is not a basic Ruby type.

Tomas

From: [email protected]
[mailto:[email protected]] On Behalf Of Meinrad
Recheis
Sent: Thursday, March 05, 2009 11:47 PM
To: [email protected]
Subject: Re: [Ironruby-core] Comparing CLR strings and Ruby strings - a
slightly surprising behaviour

Well, it slightly relates to syntax … because basic ruby types
(string, numeric, array, hash, range, etc.) use to print valid ruby
syntax on inspect. This is very useful for reinterpreting values stored
as strings by the use of inspect.
– henon
On Fri, Mar 6, 2009 at 7:04 AM, Tomas M.
<[email protected]mailto:[email protected]>
wrote:
This is not about syntax. This is just what System::String#inspect
prints out.

Tomas

“rm -Rf *”.to_clr_string
=> rm -Rf *

Copying and pasting that result would lead to bad things =P … so I say
no back ticks. Let’s stick with single quotes … it’s not a difficult
thing to change in the future.

~js

Fair enough!