Ruby-dev summary 17875-17964

There was a lot of discussions in ruby-dev this week.
This is a summary of those.

---- ruby-dev #17875-17964 (2002-08-01 … 2002-08-08) ----

[ruby-dev:17876] cbase in module_eval {…}

Koji Arai asked why a script as below raised
error(uninitialized constant FOO (NameError)) in 1.7.

class Foo
FOO = 1
end
Foo.module_eval { p FOO }

Matz said that it is caused by a change of Ruby specification.
He wants to make scope of constants static, but he thinks that
current behavior is not best. Any suggestions are welcome.

[ruby-dev:17882] nested method, etc

Minero Aoki pointed out that

  • nesting of method def.
  • alias/undef in method def.
  • super outside method def.

all does not raise an error in parse.y 1.203. Matz said that
it is change of Ruby specification.

[ruby-dev:17885] Ruby Development Roadmap?

TAKAHASHI Masayoshi asked:

  1. when is Ruby 1.8 released ?
  2. what is new and changed in Ruby 1.8 ?
  3. when is Ruby 1.6.8 released ?
  4. when is M17N-Ruby merged in(?)
  5. when is keyword arguments introduced in?

Matz replied:

  1. When known bugs are solved. Maybe after Matz’s summer
    vacation?
  2. Major changes are already introduced in HEAD branch.
  3. In this autumn(for RubyConf 2002)?
  4. Maybe in 1.9.0.
  5. In Ruby 2.0, because it changes many points including C API.

[ruby-dev:17907] Re: Ruby Development Roadmap?

Matz announced Ruby M17N framework would be changed.

Specification:

  • str[n] returns strings whose length is 1.
  • Notation ‘?A’ is obsoleted.
  • Encoding conversion framework for strings is introduced.
  • Encoding conversion framework for IO is introduced.

Implementation:

  • Delete ismblen(). Supports UTF-16 and GB18030.
  • Delete m17n_islead() and m17n_firstbyte() (the same reason)

K.Kosako proposed a method which goes back nth character.

m17n_back(enc, start, p, n)

Matz agreed such method is in need anyway.

[ruby-dev:17887] next parser

Minero Aoki asked Matz how to implement Ruby 2.0 parser.
Matz answered he thought two options.

  • write new recursive descent parser for Ruby

    it makes parser more flexible, but Ruby’s syntax is
    too complex to implement in this way?

  • use yacc

Minero proposed to use original (modified) byacc or bison:

  • GC-safe
  • make yyparse re-entrant
  • write action with table of pointer of functions

But Matz negatively replied that modifying yacc and distributing
it with Ruby is too hard. Minero may implement such kind of parser
in ripper 1.0.

[ruby-dev:17954] Selection IPv4/IPv6 at TCPSocket

NISHI Takao proposed new TCPSocket#new/TCPServer#new
interface.

TCPSocket#new(host, service [,ai_family=Socket::PF_UNSPEC])
TCPServer#new([host=localhost,] service [,ai_family=Socket::PF_UNSPEC])

A patch for Ruby 1.6.7(2002-03-01) is available in
http://www.koka-in.org/~zophos/lib/ruby-1.6.7-ipsocket_select_ai_family.patch

Merit:

  • make no influence on Ruby code
  • configurable IPv4/IPv6/UNSPEC by instance.

Demerit:

  • make TCPServer’s arguments a bit complex
  • In Linux(USAGI), configuration of ai_family of TCPServer
    is not used without CONFIG_IPV6_DOUBLE_BIND(kernel option)
    and IPV6_V6ONLY(socket option).

TAKAHASHI ‘Maki’ Masayoshi E-mail: maki@rubycolor.org

Thank you one more time for caring about us non-Japanese-enabled people :slight_smile:
I tried to follow "[ruby-dev:17885] Ruby Development Roadmap?"
and “[ruby-dev:17887] next parser” via babelfish but it was quite a
frustrating experience…

···

On Tue, Aug 13, 2002 at 04:45:44AM +0900, TAKAHASHI Masayoshi wrote:

There was a lot of discussions in ruby-dev this week.
This is a summary of those.


_ _

__ __ | | ___ _ __ ___ __ _ _ __
’_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

“You, sir, are nothing but a pathetically lame salesdroid!
I fart in your general direction!”
– Randseed on #Linux

Matz announced Ruby M17N framework would be changed.

Specification:

  • str[n] returns strings whose length is 1.

Won’t this cause additional allocations?

  • Notation ‘?A’ is obsoleted.

a) What would I use instead of ?A, then?

I think you propose something like:

if str[n] == “A” then; … ; end

b) What issues are there with keeping the ?A notation and instead allowing
?[utf-8 character here] notation?

c) How can I write my code so that it is compatible both with Ruby 1.6 and
with the Ruby M17N framework?

  • Encoding conversion framework for strings is introduced.
  • Encoding conversion framework for IO is introduced.

Can you elaborate on this?

Paul

···

On Tue, Aug 13, 2002 at 04:45:44AM +0900, TAKAHASHI Masayoshi wrote:

Tue, 13 Aug 2002 22:30:44 +0900, Paul Brannan pbrannan@atdesk.com pisze:

  • str[n] returns strings whose length is 1.

Won’t this cause additional allocations?

Couldn’t 256 one-character strings be preallocated statically?

I don’t know how mutability affects this though. Some languages make
strings immutable for a reason.

···


__("< Marcin Kowalczyk
__/ qrczak@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/

Hi,

  • str[n] returns strings whose length is 1.

Won’t this cause additional allocations?

Yes. Parhaps the string body can be shared.

  • Notation ‘?A’ is obsoleted.

a) What would I use instead of ?A, then?

“A”

b) What issues are there with keeping the ?A notation and instead allowing
?[utf-8 character here] notation?

?[utf-8 character here] still works.

c) How can I write my code so that it is compatible both with Ruby 1.6 and
with the Ruby M17N framework?

Use ?A. It will not be removed, just declared obsoleted.

  • Encoding conversion framework for strings is introduced.
  • Encoding conversion framework for IO is introduced.

Can you elaborate on this?

No, we can’t. Since I don’t have concrete idea yet.

						matz.
···

In message “Re: ruby-dev summary 17875-17964” on 02/08/13, Paul Brannan pbrannan@atdesk.com writes:

That actually sounds reasonable. The returned strings could be frozen,
to mark them immutable.

Paul

···

On Sat, Aug 24, 2002 at 11:29:01PM +0900, Marcin ‘Qrczak’ Kowalczyk wrote:

Couldn’t 256 one-character strings be preallocated statically?

I don’t know how mutability affects this though. Some languages make
strings immutable for a reason.