[#19075] Request For Removal: No Operator Concatenation — James Gray <james@...>

I'm disappointed that Ruby still supports this goofy syntax:

30 messages 2008/10/01
[#19076] Re: Request For Removal: No Operator Concatenation — "Gregory Brown" <gregory.t.brown@...> 2008/10/01

On Wed, Oct 1, 2008 at 1:58 PM, James Gray <james@grayproductions.net> wrote:

[#19078] Re: Request For Removal: No Operator Concatenation — "Jim Freeze" <jimfreeze@...> 2008/10/01

On Wed, Oct 1, 2008 at 1:08 PM, Gregory Brown <gregory.t.brown@gmail.com> wrote:

[#19080] Re: Request For Removal: No Operator Concatenation — James Gray <james@...> 2008/10/01

On Oct 1, 2008, at 1:15 PM, Jim Freeze wrote:

[#19081] Re: Request For Removal: No Operator Concatenation — "Jim Freeze" <jimfreeze@...> 2008/10/01

On Wed, Oct 1, 2008 at 1:29 PM, James Gray <james@grayproductions.net> wrote:

[#19082] Re: Request For Removal: No Operator Concatenation — James Gray <james@...> 2008/10/01

On Oct 1, 2008, at 1:37 PM, Jim Freeze wrote:

[#19083] Re: Request For Removal: No Operator Concatenation — Eric Hodel <drbrain@...7.net> 2008/10/01

On Oct 1, 2008, at 11:42 AM, James Gray wrote:

[#19084] Re: Request For Removal: No Operator Concatenation — "Gregory Brown" <gregory.t.brown@...> 2008/10/01

On Wed, Oct 1, 2008 at 2:45 PM, Eric Hodel <drbrain@segment7.net> wrote:

[#19087] Re: Request For Removal: No Operator Concatenation — "Jim Freeze" <jimfreeze@...> 2008/10/01

On Wed, Oct 1, 2008 at 2:10 PM, Gregory Brown <gregory.t.brown@gmail.com> wrote:

[#19132] [Feature #615] "with" operator — Lavir the Whiolet <redmine@...>

Feature #615: "with" operator

33 messages 2008/10/05
[#19137] Re: [Feature #615] "with" operator — Nobuyoshi Nakada <nobu@...> 2008/10/06

Hi,

[#19138] Re: [Feature #615] "with" operator — Paul Brannan <pbrannan@...> 2008/10/06

On Mon, Oct 06, 2008 at 10:46:49AM +0900, Nobuyoshi Nakada wrote:

[#19141] Re: [Feature #615] "with" operator — _why <why@...> 2008/10/06

On Mon, Oct 06, 2008 at 10:56:23PM +0900, Paul Brannan wrote:

[#19148] Re: [Feature #615] "with" operator — Trans <transfire@...> 2008/10/06

[#19149] Re: [Feature #615] "with" operator — "Austin Ziegler" <halostatue@...> 2008/10/06

On Mon, Oct 6, 2008 at 3:34 PM, Trans <transfire@gmail.com> wrote:

[#19150] Re: [Feature #615] "with" operator — "David A. Black" <dblack@...> 2008/10/06

Hi --

[#19154] Re: [Feature #615] "with" operator — _why <why@...> 2008/10/07

On Tue, Oct 07, 2008 at 05:47:23AM +0900, David A. Black wrote:

[#19250] default_internal encoding — Dave Thomas <dave@...>

I'm documenting default_internal for the PickAxe, and have a couple of

26 messages 2008/10/09
[#19254] Re: default_internal encoding — "Michael Selig" <michael.selig@...> 2008/10/09

Hi,

[#19255] Re: performance of C function calls in 1.8 vs 1.9 — "Michael Selig" <michael.selig@...> 2008/10/10

On Wed, Oct 8, 2008 at 3:52 PM, Paul Brannan <pbrannan / atdesk.com> wrote:

[#19289] [Bug #633] dl segfaults on x86_64-linux systems — Benjamin Floering <redmine@...>

Bug #633: dl segfaults on x86_64-linux systems

19 messages 2008/10/10

[#19315] [Feature #643] __DIR__ — Thomas Sawyer <redmine@...>

Feature #643: __DIR__

14 messages 2008/10/13

[#19342] [Bug #649] Memory leak in a array assignment? — Henri Suur-Inkeroinen <redmine@...>

Bug #649: Memory leak in a array assignment?

14 messages 2008/10/15

[#19350] Net::HTTP.post_form bug : can't post form to correct uri which contains QueryString(QueryString part are lost) and revise — Klesh <kleshwong@...>

Hi,

10 messages 2008/10/16
[#19352] Re: Net::HTTP.post_form bug : can't post form to correct uri which contains QueryString(QueryString part are lost) and revise — "Matt Todd" <chiology@...> 2008/10/16

You are trying to use GET-style query params instead of POSTing the

[#19378] Constant names in 1.9 — Dave Thomas <dave@...>

When Ruby makes the tIDENTIFIER/tCONSTANT test, it looks to see if the

13 messages 2008/10/18

[#19397] [Feature #666] Enumerable::to_hash — Marc-Andre Lafortune <redmine@...>

Feature #666: Enumerable::to_hash

14 messages 2008/10/20
[#23249] [Feature #666](Rejected) Enumerable::to_hash — Yukihiro Matsumoto <redmine@...> 2009/04/18

Issue #666 has been updated by Yukihiro Matsumoto.

[#19422] Now that lambda has more powerful arguments... — Dave Thomas <dave@...>

is there anything that

24 messages 2008/10/21
[#19423] Re: Now that lambda has more powerful arguments... — Wolfgang N疆asi-Donner <ed.odanow@...> 2008/10/21

Dave Thomas schrieb:

[#19424] Re: Now that lambda has more powerful arguments... — Dave Thomas <dave@...> 2008/10/21

[#19427] Re: Now that lambda has more powerful arguments... — Paul Brannan <pbrannan@...> 2008/10/21

On Wed, Oct 22, 2008 at 04:01:45AM +0900, Dave Thomas wrote:

[#19429] Re: Now that lambda has more powerful arguments... — "David A. Black" <dblack@...> 2008/10/21

Hi --

[#19430] Re: Now that lambda has more powerful arguments... — Paul Brannan <pbrannan@...> 2008/10/21

On Wed, Oct 22, 2008 at 04:38:19AM +0900, David A. Black wrote:

[#19431] Re: Now that lambda has more powerful arguments... — "David A. Black" <dblack@...> 2008/10/21

Hi --

[#19432] Re: Now that lambda has more powerful arguments... — Jim Weirich <jim.weirich@...> 2008/10/21

On Oct 21, 2008, at 4:24 PM, David A. Black wrote:

[#19465] [Bug #680] csv.rb: CSV.parse is too late when encoding is mismatch — Takeyuki Fujioka <redmine@...>

Bug #680: csv.rb: CSV.parse is too late when encoding is mismatch

41 messages 2008/10/24
[#19466] Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is too late when encoding is mismatch) — "Michael Selig" <michael.selig@...> 2008/10/24

Hi,

[#19471] Re: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch) — Martin Duerst <duerst@...> 2008/10/24

A default for the source encoding has been discussed quite a long

[#19480] Re: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch) — James Gray <james@...> 2008/10/24

On Oct 24, 2008, at 1:52 AM, Martin Duerst wrote:

[#19473] Re: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch) — "Michael Selig" <michael.selig@...> 2008/10/24

Hi,

[#19474] Re: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch) — Yukihiro Matsumoto <matz@...> 2008/10/24

Hi,

[#19515] String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — "Michael Selig" <michael.selig@...> 2008/10/26

Hi,

[#19517] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — Nobuyoshi Nakada <nobu@...> 2008/10/26

Hi,

[#19518] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — "Michael Selig" <michael.selig@...> 2008/10/26

On Sun, 26 Oct 2008 17:26:32 +1100, Nobuyoshi Nakada <nobu@ruby-lang.org>

[#19522] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — Nobuyoshi Nakada <nobu@...> 2008/10/26

Hi,

[#19525] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — "Michael Selig" <michael.selig@...> 2008/10/26

On Sun, 26 Oct 2008 23:34:26 +1100, Nobuyoshi Nakada <nobu@ruby-lang.org>

[#19531] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — Nobuyoshi Nakada <nobu@...> 2008/10/27

Hi,

[#19532] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — "Michael Selig" <michael.selig@...> 2008/10/27

On Mon, 27 Oct 2008 16:07:54 +1100, Nobuyoshi Nakada <nobu@ruby-lang.org>

[#19533] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — Nobuyoshi Nakada <nobu@...> 2008/10/27

Hi,

[#19535] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — "Michael Selig" <michael.selig@...> 2008/10/27

On Mon, 27 Oct 2008 17:27:57 +1100, Nobuyoshi Nakada <nobu@ruby-lang.org>

[#19538] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — Nobuyoshi Nakada <nobu@...> 2008/10/27

Hi,

[#19540] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — "Michael Selig" <michael.selig@...> 2008/10/27

On Mon, 27 Oct 2008 20:55:32 +1100, Nobuyoshi Nakada <nobu@ruby-lang.org>

[#19546] Re: String literal encoding (Was: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)) — Nobuyoshi Nakada <nobu@...> 2008/10/27

Hi,

[#19566] GC thought — "Roger Pack" <roger.pack@...>

Here is a recent patch I've been experimenting with--for any advice. [1]

26 messages 2008/10/28
[#19569] Re: GC thought — Ken Bloom <kbloom@...> 2008/10/28

On Tue, 28 Oct 2008 17:02:17 +0900, Roger Pack wrote:

[#19575] Re: GC thought — "Roger Pack" <roger.pack@...> 2008/10/28

> Letting the program continue execution during the mark phase could cause

[#19577] Re: GC thought — Paul Brannan <pbrannan@...> 2008/10/28

On Wed, Oct 29, 2008 at 01:04:52AM +0900, Roger Pack wrote:

[#19596] Re: GC thought — "Robert Klemme" <shortcutter@...> 2008/10/29

2008/10/28 Paul Brannan <pbrannan@atdesk.com>:

[#19590] [Feature #695] More flexibility when combining ASCII-8BIT strings with other encodings — Michael Selig <redmine@...>

Feature #695: More flexibility when combining ASCII-8BIT strings with other encodings

13 messages 2008/10/29
[#19646] Re: [Feature #695] More flexibility when combining ASCII-8BIT strings with other encodings — "Michael Selig" <michael.selig@...> 2008/10/30

Hi,

[ruby-core:19473] Re: Default source encoding (Was: [Bug #680] csv.rb: CSV.parse is toolate when encoding is mismatch)

From: "Michael Selig" <michael.selig@...>
Date: 2008-10-24 07:48:04 UTC
List: ruby-core #19473
Hi,

I am not sure I understand your argument about not defaulting the source  
encoding.

The problem I am trying to solve is the compatibility of string literals  
in your source and strings from other sources.

"default_internal" was introduced to try to make all strings the same  
encoding to avoid incompatibilities. But at the moment string literals  
seem to default to the source encoding or to UTF-8 if oit is not set  
(please correct me if I am wrong). What I was suggesting was a way to make  
string literals be compatible.

This normally isn't a problem if:
a) All string literals are 7 bit ASCII, or
b) The source encoding matches "default_internal"

If the source encoding of a program containing non-ascii string literals  
is set different from default_internal, you are asking for trouble, and  
would defeat the purpose of default_internal. Therefore to prevent the  
programmer from having to remember to specify both, it makes sense to me  
that the source encoding should default to default_internal. I think this  
is important.

Now when default_internal is not set, we have some different issues. If  
the source encoding defaults to the locale, this may cause different  
behaviour and confusion if the script is run in different locales.  
However, "default_external" already defaults to the locale, and with  
"default_internal" not set, it means that strings read from files are  
going to be in the locale's encoding anyhow. So that possibly means  
encoding compatibility issues between data read from file and string  
literals. Either way, there are possible problems. Possibly the better  
solution when default_internal is not set is to default the source  
encoding to "default_external" (which is in turn defaulted to the locale).

(By the way, I am not talking about libraries here. As I have stressed  
previously, libraries should be carefully written to either use ASCII  
string literals only, or to make sure that it transcodes them properly.)

The only other (and perhaps better) solution I can think of is to separate  
the notion of "source encoding" and "string literal encoding". Then you  
can have the source encoding set to anything, but always force non-ascii  
string literals to the "string literal encoding", which can default to  
Encoding.default_internal || Encoding.default_external. But perhaps this  
is going over-board with too many different encoding settings.

Finally, are you suggesting that "-e" should perform differently to a  
single-line ruby script? That seems non-intuitive to me.

Cheers,
Mike

On Fri, 24 Oct 2008 17:52:17 +1100, Martin Duerst <duerst@it.aoyama.ac.jp>  
wrote:

> A default for the source encoding has been discussed quite a long
> time ago (in some Japanese meetings or on ruby-dev, I don't remember),
> and the conclusion was that the source encoding has to be given
> (with a majic comment) in the file itself (unless the file is all ascii).
>
> The reason for this is that the source encoding is a property of the
> source, and nothing else. On very simple scripts, it might occasionally
> be slightly easier if it were the same as default_external or
> default_internal, but this is only the case as long as you stay
> in exactly the same environment, and don't move the script.
> But scripts grow and move, so it's better to get the settings
> right at the start.
>
> However, as far as I remember, the idea was that for -e,
> default_external should be used, because that's what one
> is using in a shell. I'm not sure why this doesn't work below.
> (assuming Takeyuki is working in a Shift_JIS environment,
> which isn't completely sure).
>
> Regards,    Martin.
>
>
> At 12:12 08/10/24, Michael Selig wrote:
>> Hi,
>>
>> This bug actually brings up an interesting issue - should the source
>> encoding default to something other than UTF-8 (ie: if it is not  
>> specified
>> in the "magic comment")?
>>
>> Perhaps it should default to the encoding specified by the user's  
>> locale?
>> Or perhaps it should default to the value of "default_internal" if it is
>> set? Or even default_external?
>>
>> I suggest that it should default to "default_internal" if that is set,  
>> and
>> then to the locale encoding if not.
>>
>> What do others think?
>> Having it default to the locale in this case would probably avoid the
>> encoding mismatch entirely (and the resulting confusion).
>>
>> Cheers
>> Mike
>>
>> On Fri, 24 Oct 2008 11:58:33 +1100, Takeyuki Fujioka
>> <redmine@ruby-lang.org> wrote:
>>
>>> Bug #680: csv.rb: CSV.parse is too late when encoding is mismatch
>>> http://redmine.ruby-lang.org/issues/show/680
>>>
>>> Author: Takeyuki Fujioka
>>> Status: Open, Priority: Normal
>>> Category: lib, Target version: 1.9.x
>>>
>>> I think this result is true, but encoding mismatch raise is too late.
>>>
>>> see:
>>> % time ruby19 -rcsv -e
>>> 'CSV.parse(("\x82\xA0,\x82\xA2\n"*10000).force_encoding("shift_jis"))'
>>> ruby19 -rcsv -e   0.30s user 0.02s system 96% cpu 0.330 total
>>>
>>> % time ruby19 -rcsv -e 'CSV.parse(("\x82\xA0,\x82\xA2\n"*10000))'
>>> /Users/fujioka/local/lib/ruby/1.9.0/csv.rb:1981:in `=~': broken UTF-8
>>> string (ArgumentError)
>>>      from /Users/fujioka/local/lib/ruby/1.9.0/csv.rb:1981:in
>>> `init_separators'
>>>      from /Users/fujioka/local/lib/ruby/1.9.0/csv.rb:1563:in  
>>> `initialize'
>>>      from /Users/fujioka/local/lib/ruby/1.9.0/csv.rb:1350:in `new'
>>>      from /Users/fujioka/local/lib/ruby/1.9.0/csv.rb:1350:in `parse'
>>>      from -e:1:in `<main>'
>>> ruby19 -rcsv -e 'CSV.parse(("\x82\xA0,\x82\xA2\n"*10000))'  1.55s user
>>> 2.57s system 90% cpu 4.530 total
>>>
>>>
>>> ----------------------------------------
>>> http://redmine.ruby-lang.org
>>
>>
>>
>
>
> #-#-#  Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
> #-#-#  http://www.sw.it.aoyama.ac.jp       mailto:duerst@it.aoyama.ac.jp
>



In This Thread