[#4595] New block syntax — Daniel Amelang <daniel.amelang@...>

I'm really sorry if this isn't the place to talk about this. I've

25 messages 2005/03/21
[#4606] Re: New block syntax — "David A. Black" <dblack@...> 2005/03/21

Hi --

[#4629] Re: New block syntax — "Sean E. Russell" <ser@...> 2005/03/30

On Monday 21 March 2005 16:17, David A. Black wrote:

[#4648] about REXML::Encoding — speakillof <speakillof@...>

Hi.

15 messages 2005/03/31
[#4659] Re: about REXML::Encoding — "Sean E. Russell" <ser@...> 2005/04/04

On Thursday 31 March 2005 09:44, speakillof wrote:

Re: Win32 Non-ASCII Filename Access

From: "Berger, Daniel" <Daniel.Berger@...>
Date: 2005-03-09 19:10:17 UTC
List: ruby-core #4541
> -----Original Message-----
> From: Austin Ziegler [mailto:halostatue@gmail.com] 
> Sent: Wednesday, March 09, 2005 11:48 AM
> To: ruby-core@ruby-lang.org
> Subject: Re: Win32 Non-ASCII Filename Access

<snip>

> Okay -- let's try again. Ruby isn't written in Microsoft's 
> dialect of C++. It doesn't use TCHAR. It uses char. Saying 
> that Ruby needs to use TCHAR would be a Bad Thing.

Why?  Who's to say MS got it wrong?  Types like TCHAR can easily be
defined in ruby.h (or wherever), since *nix understands wchar_t
perfectly well.  Would it not have been better to do this:

#ifdef UNICODE 
    typedef wchar_t TCHAR; 
#else 
    typedef unsigned char TCHAR; 
#endif 

And then have Matz decree, "Thou shallt use TCHAR, not char*, in your C
extensions"?  Would it not have been better for Ruby 1.x if it had taken
this approach?

This isn't a rhetorical question - I'm genuinely curious.  Are there
factors I'm not considering that make this impractical?
 
> I don't have the Ruby code in front of me, but a lot of 
> things probably wouldn't work quite the same if we used the 
> UNICODE macro. String#each_byte, anyone?

It would be a case of caveat programmor in the case of String methods
and the like.  If you're using unicode, then something like
String#each_byte would either return 2 bytes per char, or would yield
two separate 8-bit chars.

Maybe that's a bit harsh, but my philosophy is, if you're going to use
Unicode, make sure you understand the ramifications.  Undoubtedly, many
will disagree. :) 

I'm actually curious what Matz and other folks think about the idea of
defining a TCHAR for Ruby.

Regards,

Dan




In This Thread

Prev Next