Ruby-dev summary 21134-21191

Hi all,

This is a summary of ruby-dev ML in these days.

[ruby-dev:21139] owner of installed files

Tietew reported a security bug of ruby 1.8.0 installer.
The owner of installed files becomes the user who built
the ruby, not installed. If you compiled and installed
ruby in different users, check it now.

[ruby-dev:21146] Regexp.alt(pat1, pat2, …)

TANAKA Akira proposed a new method Regexp.alt, which makes a new
Regexp object from its sub-patterns. e.g.

Regexp.alt(/aa/, /bb/, /cc/)  ==  /aa|bb|cc/

Matz agreed with him on the concept, but we still needs better name.
Akira suggested “union” and “or” and Matz selected “union”.

[ruby-dev:21147] [Oniguruma] list of all captures
[ruby-dev:21174] [Oniguruma] Version 1.9.2

TANAKA Akira suggested a new function, to capture all matchings for
the one expression. e.g.

m = /(?@<name>\/\w+)+/.match("/usr/local/bin/ruby")
p m['name']   #=> ["/usr", "/local", "/bin", "/ruby"]

Get latest version from:

ftp://ftp.ruby-lang.org/pub/ruby/contrib/onigd20030808.tar.gz

[ruby-dev:21153] ChangeLog

U.Nakamura asked matz when we should update ChangeLog.
Answer:

* We should update ChangeLog if we modify any file in the standard
  distribution, including lib/ and ext/.

Nobuyoshi Nakada also asked matz when we should update version.h.
Answer:

* We should update version.h if we modify any file in the standard
  distribution, including lib/ and ext/.

[ruby-dev:21170] soap4r to /src/ruby/lib

NAKAMURA Hiroshi announced that he is ready to import soap4r in the
ruby’s CVS repository. But we still have some problems:

* soap4r depends on devel-logger.
* soap4r depends on http-access2
  (http-access2 covers almost same layer with net/http).

Minero Aoki suggested to bundle http-access2 as the internal library
of soap4r (e.g. soap4r/http).

– Minero Aoki

What does http-access2 have that net/http does not? Could soap4r be
rewritten to use net/http?

Paul

···

On Fri, Aug 15, 2003 at 01:01:36AM +0900, Minero Aoki wrote:

[ruby-dev:21170] soap4r to /src/ruby/lib

NAKAMURA Hiroshi announced that he is ready to import soap4r in the
ruby’s CVS repository. But we still have some problems:

* soap4r depends on devel-logger.
* soap4r depends on http-access2
  (http-access2 covers almost same layer with net/http).

Minero Aoki suggested to bundle http-access2 as the internal library
of soap4r (e.g. soap4r/http).

Hi –

TANAKA Akira suggested a new function, to capture all matchings for
the one expression. e.g.

m = /(?@<name>\/\w+)+/.match("/usr/local/bin/ruby")
p m['name']   #=> ["/usr", "/local", "/bin", "/ruby"]

Question:

Would this also be captured in the numerically indexed submatches?
(So, in the above, m[1] would still be “/ruby”.)

Comment:

The first thing I thought was that this looks like an alternative way
(or very close) of doing this:

name = “/usr/local/bin/ruby”.scan(//\w+/)

and I still kind of think that :slight_smile: Is there a big advantage to making
this kind of result-naming a regex extension, rather than just using
regexes to generate the results and saving/naming the results
separately (the way #scan does)?

(I guess that comment was really also a question :slight_smile:

David

···

On Fri, 15 Aug 2003, Minero Aoki wrote:


David Alan Black
home: dblack@superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav

Hi,

From: “Paul Brannan” pbrannan@atdesk.com
Sent: Friday, August 15, 2003 1:38 AM

NAKAMURA Hiroshi announced that he is ready to import soap4r in the
ruby’s CVS repository. But we still have some problems:

* soap4r depends on devel-logger.
* soap4r depends on http-access2
  (http-access2 covers almost same layer with net/http).

Minero Aoki suggested to bundle http-access2 as the internal library
of soap4r (e.g. soap4r/http).

What does http-access2 have that net/http does not?

Thread safe. At least I hope. And simple implementation that is
easy enough for me to maintenance.

Could soap4r be rewritten to use net/http?

soap4r now runs with net/http. You can connect to server via
HTTP without http-access2. With http-access2, you also get;

  • Thread safe SOAP client
  • Persistent connection (faster when multiple connection to the same server)

Regards,
// NaHi

“Paul Brannan” pbrannan@atdesk.com wrote in message

What does http-access2 have that net/http does not?

From RAA:

···

Description: http-access2 gives something like the functionality of
libwww-perl (LWP) in Ruby.

Features:

  • methods like GET/HEAD/POST via HTTP/1.1.
  • asynchronous HTTP request
  • by contrast with net/http in standard distribution;
  • you don’t have to care HTTP/1.1 persistent connection (http-access2 cares
    instead of you).
  • MT-safe
  • streaming POST

Could soap4r be rewritten to use net/http?

Sorry I don’t know the answer to that one.

Paul

– shanko

Apologies if this gets posted twice. I posted it to some random news server
hours ago but it hasn’t shown up, so I’m doing it on groups.google.com now.

What about:

re = /((?@(/\w+)+/)(?@\w+),?)+/

m = re.match(“/usr/local/bin/ruby,/bin/bash,/sbin/reboot”)

m[‘paths’] # => [“/usr/local/bin/”, “/bin/”, “/sbin/”]
m[‘filenames’] # => [“ruby”, “bash”, “reboot”]

My regexps may be off (didn’t test :)), but you get the idea.
Wouldn’t that require multiple regexps with scan? This could be
moderately useful, I’d imagine.

  • Dan (posting from google because the blackout killed his mail server :frowning: )

dblack@superlink.net wrote

···

Hi –

On Fri, 15 Aug 2003, Minero Aoki wrote:

TANAKA Akira suggested a new function, to capture all matchings for
the one expression. e.g.

m = /(?@<name>\/\w+)+/.match("/usr/local/bin/ruby")
p m['name']   #=> ["/usr", "/local", "/bin", "/ruby"]

Question:

Would this also be captured in the numerically indexed submatches?
(So, in the above, m[1] would still be “/ruby”.)

Comment:

The first thing I thought was that this looks like an alternative way
(or very close) of doing this:

name = “/usr/local/bin/ruby”.scan(//\w+/)

and I still kind of think that :slight_smile: Is there a big advantage to making
this kind of result-naming a regex extension, rather than just using
regexes to generate the results and saving/naming the results
separately (the way #scan does)?

What about:

re = /((?@(/\w+)+/)(?@\w+),?)+/

m = re.match(“/usr/local/bin/ruby,/bin/bash,/sbin/reboot”)

m[‘paths’] # => [“/usr/local/bin/”, “/bin/”, “/sbin/”]
m[‘filenames’] # => [“ruby”, “bash”, “reboot”]

My regexps may be off (didn’t test :)), but you get the idea.
Wouldn’t that require multiple regexps with scan?

  • Dan (posting from a news server because the blackout killed his e-mail
    :frowning: )

dblack@superlink.net wrote:

···

Comment:

The first thing I thought was that this looks like an alternative way
(or very close) of doing this:

name = “/usr/local/bin/ruby”.scan(//\w+/)

and I still kind of think that :slight_smile: Is there a big advantage to making
this kind of result-naming a regex extension, rather than just using
regexes to generate the results and saving/naming the results
separately (the way #scan does)?

(I guess that comment was really also a question :slight_smile:

David

Hi –

What about:

re = /((?@(/\w+)+/)(?@\w+),?)+/

m = re.match(“/usr/local/bin/ruby,/bin/bash,/sbin/reboot”)

m[‘paths’] # => [“/usr/local/bin/”, “/bin/”, “/sbin/”]
m[‘filenames’] # => [“ruby”, “bash”, “reboot”]

My regexps may be off (didn’t test :)), but you get the idea.
Wouldn’t that require multiple regexps with scan?

No, one will do it, though the results come back in a somewhat
different form:

str=“/usr/local/bin/ruby,/bin/bash,/sbin/reboot”
re=/((?:/\w+)+)/(\w+),?/
str.scan(re)
=> [[“/usr/local/bin”, “ruby”], [“/bin”, “bash”], [“/sbin”, “reboot”]]

The proposed regex extension would be more concise if you wanted to
flip these into two arrays, though probably less concise for other
things, like making a hash from them. I guess it’s a matter of
weighing that potential conciseness against what feels to me like the
pretty major step of regexes including arbitrary strings which don’t
convey any information about the match. I think my own inclination
would be to want to keep that kind of information off-loaded and out
of the regex itself.

I’m also wondering what effect the proposed extension would have on
MatchData#to_a, if the MatchData object had non-numerical indices.

David

···

On Fri, 15 Aug 2003, Dan Doel wrote:


David Alan Black
home: dblack@superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav

Ooo! I know, what about:

re = /((?@\d+)|(?@\w+)\s?)+/
m = re.match(“1234 hello 56 what are you doing 98”)
m[‘numbers’] #=> [“1234”, “56”, “98”]
m[‘words’] #=> [“hello”, “what”, “are”, “you”, “doing”]

Is there an alternate solution to that that doesn’t use multiple regexps?

  • Dan

Hi –

···

On Sat, 16 Aug 2003, Dan Doel wrote:

Ooo! I know, what about:

re = /((?@\d+)|(?@\w+)\s?)+/
m = re.match(“1234 hello 56 what are you doing 98”)
m[‘numbers’] #=> [“1234”, “56”, “98”]
m[‘words’] #=> [“hello”, “what”, “are”, “you”, “doing”]

Is there an alternate solution to that that doesn’t use multiple regexps?

I can’t think of one – but I can think of a solution I like a lot
anyway :slight_smile: It makes use of the new Enumerable#partition:

words,numbers = str.scan(/\d+|\w+/).partition {|e| /\D/.match(e) }

David


David Alan Black
home: dblack@superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav