[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby-dev summary: 21928-22011

TAKAHASHI Masayoshi

11/28/2003 6:57:00 PM

4 Answers

Simon Strandgaard

11/28/2003 9:34:00 PM

0

On Sat, 29 Nov 2003 03:57:05 +0900, Masayoshi Takahashi wrote:
> [ruby-dev:21933] new hash literal
> Nobu Nakata read Matz's RC2003 slides
> (http://www.rubyist.net/~matz/slides/rc2003/mgp...)
> and made a patch for a new hash literal like {key: value}.

Matz slide says:
{a: 45, b: 55, c: 65} same as {:a => 45, :b => 55 :c => 65}


Will it be possible to leave out spaces,
so that {a:45, b:55, c:65} are possible ?

Leaving out comma, will it be possible?
like this: {a:45 b:55 c:65}

What happens if no value are specified ? nil?
For instance 'verbose:' has no value
copy source:"file.in" dest:"file.out" verbose:


--
Simon Strandgaard

nobu.nokada

11/29/2003 8:30:00 AM

0

Hi,

At Sat, 29 Nov 2003 06:42:13 +0900,
Simon Strandgaard wrote:
> > [ruby-dev:21933] new hash literal
> > Nobu Nakata read Matz's RC2003 slides
> > (http://www.rubyist.net/~matz/slides/rc2003/mgp...)
> > and made a patch for a new hash literal like {key: value}.
>
> Matz slide says:
> {a: 45, b: 55, c: 65} same as {:a => 45, :b => 55 :c => 65}
>
>
> Will it be possible to leave out spaces,
> so that {a:45, b:55, c:65} are possible ?

Yes, but impossible to put spaces before colons.

{a :45, b :55, c :65} same as {a(:45), b(:55), c(:65)}

But :45 and so on cause SyntaxError, of course.

> Leaving out comma, will it be possible?
> like this: {a:45 b:55 c:65}

No. I've not thought about such syntax.

> What happens if no value are specified ? nil?
> For instance 'verbose:' has no value
> copy source:"file.in" dest:"file.out" verbose:

Parse error.

--
Nobu Nakada


Simon Strandgaard

11/29/2003 11:51:00 AM

0

Thanks for your insight, Nobu.

--
Simon Strandgaard

matz

11/29/2003 3:12:00 PM

0

Hi,

In message "Re: ruby-dev summary: 21928-22011"
on 03/11/29, Simon Strandgaard <neoneye@adslhome.dk> writes:

|Matz slide says:
|{a: 45, b: 55, c: 65} same as {:a => 45, :b => 55 :c => 65}
|
|Will it be possible to leave out spaces,
|so that {a:45, b:55, c:65} are possible ?

Possible.

|Leaving out comma, will it be possible?
|like this: {a:45 b:55 c:65}

Not possible.

|What happens if no value are specified ? nil?
|For instance 'verbose:' has no value
| copy source:"file.in" dest:"file.out" verbose:

Not possible. You always have to specify value to the keyword
arguments.

copy(source:"file.in", dest:"file.out", verbose:true)

matz.