[#4522] Undefined Errno::EPROTO and the like raises NameError — "Florian Frank" <flori@...>
Hi,
[#4533] giving acces readline to rl_line_buffer — "Cs. Henk" <csaba-ml@...>
Hi!
[#4548] Ruby 1.8.2 array of hash entries functions incorrectly — noreply@...
Bugs item #1613, was opened at 2005-03-09 19:49
[#4561] rb_reg_quote weirdness — Nikolai Weibull <mailing-lists.ruby-core@...>
(Two weirdnesses in one day.)
Hi,
[#4567] Immutable Ropes — Nikolai Weibull <mailing-lists.ruby-core@...>
Note how I didn't write "Immutable Strings" in the subject.
[#4575] Allowing "?" in struct members — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#4587] 0**0==1? — Bertram Scharpf <lists@...>
Hi,
[#4595] New block syntax — Daniel Amelang <daniel.amelang@...>
I'm really sorry if this isn't the place to talk about this. I've
Daniel Amelang wrote:
Hi --
On Monday 21 March 2005 16:17, David A. Black wrote:
Hi --
Hey David, I think that we've had some misunderstandings due to
Hi --
On Wednesday 30 March 2005 20:55, David A. Black wrote:
On Sunday 20 March 2005 21:31, Daniel Amelang wrote:
[#4601] Re: New block syntax — "Berger, Daniel" <Daniel.Berger@...>
> -----Original Message-----
[#4611] want_object? - possible? — "Berger, Daniel" <Daniel.Berger@...>
Hi all,
[#4619] Re: want_object? - possible? — Daniel Berger <djberg96@...>
--- nobu.nokada@softhome.net wrote:
Hi --
On 3/24/05, David A. Black <dblack@wobblini.net> wrote:
Hi --
On 4/14/05, David A. Black <dblack@wobblini.net> wrote:
On 14 Apr 2005, at 22:20, Mark Hubbart wrote:
On 4/15/05, Eric Hodel <drbrain@segment7.net> wrote:
[#4622] tempfile.rb — Tilman Sauerbeck <tilman@...>
Hi,
[#4648] about REXML::Encoding — speakillof <speakillof@...>
Hi.
On Thursday 31 March 2005 09:44, speakillof wrote:
Hi.
I've tested, applied, and committed your Encoding patch, Nobu.
Hi,
Re: New block syntax
On Wednesday 30 March 2005 07:55, David A. Black wrote:
> I find the visual reliance on the : separator as an indicator of
> constructor behavior obscure and fragile. But also, in more practical
Ok.
> terms, I wonder what would happen to something like:
>
> a = SomeClass.new
> b = 100
>
> { a => "apple", b => "orange" }
>
> It couldn't be [a:'apple', b:'orange'], of course. I think that means
Why not? ':' as a prefix to denote symbols works just fine. Using it for
hashes would result in:
[ a : 'apple', b : 'orange' ]
[ a: 'apple', b: 'orange' ]
[ 'a': 'apple', 'b': 'orange' ]
[ a:apple, b:orange ]
'a:apple' is not a legal token in Ruby, so it could *only* be parsed as a hash
key/value pair. However, then we get into issues of whether the key/values
are parsed as strings or variables, so if I were in charge, the syntax would
be:
[ 'key' : 'value', 'key2' : 'value2' ]
with or without the space before the ':'.
I also sort of like the re-use of [] here, and reserving {} for lambda
expressions. This sort of un-perlifies Ruby, where you have different
enclosing and prefix tokens for every different kind of variable.
> there would have to be another literal hash constructor for hashes
> whose keys were not symbols, or some other workaround or special-case
> (which it actually isn't) expression.
Heh. As strange-looking as this is, I still believe that there is only one
way to parse the each of the following (given the syntax we're discussing):
[ :key::value ]
[ 'key'::value ]
[ 'key'::'value']
[ 'key' : :value ]
[ :key : :value ]
> All of this just seems like so much upheaval to avoid the
> (comparatively unusual [compared to hash literals, that is]) keyword
> 'lambda'.
This isn't about not using the 'lambda' keyword, although that may have been
the genesis of the proposal. We can still do away with the 'lambda' keyword
without changing hashes, as originally proposed with:
func = {|| x = 1 }
The 'lambda' keyword *is* tedious, if you use higher-order functions a lot.
But, personally, I like the proposed change to hash syntax; I feel it is more
orthoganal, easy to remember (albeit mildly), and easier to type than the
current syntax.
Furthermore, a language shouldn't be afraid to change. If we're afraid to
improve Ruby, someone will do to Ruby what Ruby has done to Perl.
Incidently, I say 'we', although 'we' have absolutely no say in the matter.
We can discuss until we're blue in the face, but if Matz doesn't like the
syntax, it'll never see the light of day. IME, I think you're pretty safe; I
doubt the syntax for Hash will be changed.
--
--- SER
"As democracy is perfected, the office of president represents,
more and more closely, the inner soul of the people. On some
great and glorious day the plain folks of the land will reach
their heart's desire at last and the White House will be adorned
by a downright moron." - H.L. Mencken (1880 - 1956)