[ruby-dev:23616] [Oniguruma] Version 3.1.0 and 2.2.9
Kosako announced the new release of Oniguruma, which is a regular
expression matching engine working with ruby.
[ruby-dev:23572] keyword argments (Ruby2.0 spec)
Nagai asked how keyword arguments and hash-style arguments work in
ruby-2.0, since a lot of hash-style arguments appear in his extension
library ‘Ruby/Tk’. Matz proposed following two solutions.
(a) hash-style argument appearing at the end of argument list is
supported as usual.
(b) hash-style arguments were abolished.
Nagai chose a case for (b) because of rapid shift to ruby-2.0.
[ruby-dev:23567] for smoother extending PStore
Nishiyama posted a patch for smoother extending PStore#dump and
PStore#load. This change is useful for implementation of YAML::Store.
Nagai asked how keyword arguments and hash-style arguments work in
ruby-2.0, since a lot of hash-style arguments appear in his extension
library ‘Ruby/Tk’. Matz proposed following two solutions.
(a) hash-style argument appearing at the end of argument list is
supported as usual.
(b) hash-style arguments were abolished.
I’d prefer (a), because backward-compatibility is a good thing, and I’d
prefer to change my code as little as possible to make it work on Ruby
2.0.
But how would (a) work? It seems like it would make the following
ambiguous:
def foo(foo, bar=2)
end
foo(:foo => 14, :bar => 92)
(is this calling foo with a hash and leaving bar with default argument,
or is it calling foo with foo equal to 14 and bar equal to 92?)
If (b) is chosen, it would be nice if hash-style arguments were
deprecated for a version between current and 2.0.
Nagai chose a case for (b) because of rapid shift to ruby-2.0.
I don’t understand. What is meant by “rapid shift to ruby-2.0”?
Paul
···
On Thu, Jun 03, 2004 at 12:00:51AM +0900, Takaaki Tateishi wrote:
Nagai asked how keyword arguments and hash-style arguments work in
ruby-2.0, since a lot of hash-style arguments appear in his extension
library ‘Ruby/Tk’. Matz proposed following two solutions.
(a) hash-style argument appearing at the end of argument list is
supported as usual.
(b) hash-style arguments were abolished.
Nagai chose a case for (b) because of rapid shift to ruby-2.0.
Nagai asked how keyword arguments and hash-style arguments work in
ruby-2.0, since a lot of hash-style arguments appear in his extension
library ‘Ruby/Tk’. Matz proposed following two solutions.
(a) hash-style argument appearing at the end of argument list is
supported as usual.
(b) hash-style arguments were abolished.
I’d prefer (a), because backward-compatibility is a good thing, and I’d
prefer to change my code as little as possible to make it work on Ruby
2.0.
I’d vote for (a), too. I use this syntax as part of the programmer’s
interface of a simulation language embedded in ruby. So it’s not a just
matter of updating my own code, but of changing the interface that users
see.
Here’s an example of code written in this embedded language:
class C
flow { diff “x’ = 1” } # Runge-Kutta integration
transition State1 => State2, State3 => State4 do
guard “x > 2”
reset :x => 0
end
end
It just doesn’t look the same with
transition State1: State2 do …
or
reset x: 0
But maybe I’ve relied too much on an incidental aspect of ruby syntax…
···
On Thu, Jun 03, 2004 at 12:00:51AM +0900, Takaaki Tateishi wrote:
Nagai asked how keyword arguments and hash-style arguments work in
ruby-2.0, since a lot of hash-style arguments appear in his extension
library 'Ruby/Tk'. Matz proposed following two solutions.
(a) hash-style argument appearing at the end of argument list is
supported as usual.
(b) hash-style arguments were abolished.
I'd prefer (a), because backward-compatibility is a good thing, and I'd
prefer to change my code as little as possible to make it work on Ruby
2.0.
But I suspect there will be lots of changes needed for Ruby 1.x source to work with Ruby2. For instance, as I understand, the syntax for hash literal will become:
sorry for asking again, but I went ignored the first time, this is the
last time I try:
Why we make a distinction beetween positional/default args and named
args ?
Being able to threat them equally would be much more useful I believe,
cause it would allow smatrte usage of many of the existing libraries
(say, all the GUI code)
···
il Thu, 3 Jun 2004 09:24:32 +0900, nobu.nokada@softhome.net ha scritto::
Hi,
At Thu, 3 Jun 2004 02:33:44 +0900,
Paul Brannan wrote in [ruby-talk:102177]:
But how would (a) work? It seems like it would make the following
ambiguous:
def foo(foo, bar=2)
end
foo(:foo => 14, :bar => 92)
(is this calling foo with a hash and leaving bar with default argument,
or is it calling foo with foo equal to 14 and bar equal to 92?)
{a: 1} in Ruby >= 1.9 is just a short form for {:a => 1} or at least
that's how I understood it.
Regards,
Michael
···
On Thu, Jun 03, 2004 at 07:07:17PM +0900, David Garamond wrote:
Paul Brannan wrote:
>>[ruby-dev:23572] keyword argments (Ruby2.0 spec)
>>
>> Nagai asked how keyword arguments and hash-style arguments work in
>> ruby-2.0, since a lot of hash-style arguments appear in his extension
>> library 'Ruby/Tk'. Matz proposed following two solutions.
>> (a) hash-style argument appearing at the end of argument list is
>> supported as usual.
>> (b) hash-style arguments were abolished.
>
>
>I'd prefer (a), because backward-compatibility is a good thing, and I'd
>prefer to change my code as little as possible to make it work on Ruby
>2.0.
But I suspect there will be lots of changes needed for Ruby 1.x source
to work with Ruby2. For instance, as I understand, the syntax for hash
literal will become:
the old syntax should remain. But in addition you get:
foo: bar
that would mean:
:foo => bar
···
il Thu, 3 Jun 2004 19:07:17 +0900, David Garamond <lists@zara.6.isreserved.com> ha scritto::
But I suspect there will be lots of changes needed for Ruby 1.x source
to work with Ruby2. For instance, as I understand, the syntax for hash
literal will become:
At Thu, 3 Jun 2004 19:09:59 +0900,
gabriele renzi wrote in [ruby-talk:102251]:
>At Thu, 3 Jun 2004 02:33:44 +0900,
>Paul Brannan wrote in [ruby-talk:102177]:
>> But how would (a) work? It seems like it would make the following
>> ambiguous:
>>
>> def foo(foo, bar=2)
>> end
>>
>> foo(:foo => 14, :bar => 92)
>>
>> (is this calling foo with a hash and leaving bar with default argument,
>> or is it calling foo with foo equal to 14 and bar equal to 92?)
>
>The former. The latter syntax will be
>
> foo(foo: 14, bar: 92)
Why we make a distinction beetween positional/default args and named
args ?
This is not that distinction, but between hash literal and
named args.