[#32676] VC++ embedded rubygems gives NoMethodError undefined method `synchronize' for Mutex — Phlip <phlip2005@...>
[I will try Bill Kelly's PDB path advice presently; this issue is more
5 messages
2010/10/03
[#32687] Re: VC++ embedded rubygems gives NoMethodError undefined method `synchronize' for Mutex
— Roger Pack <rogerdpack2@...>
2010/10/04
> This one's about...
[#32703] Re: VC++ embedded rubygems gives NoMethodError undefined method `synchronize' for Mutex
— Phlip <phlip2005@...>
2010/10/05
> > #<NoMethodError: undefined method `synchronize' for #<Mutex:0x750faa8>>
[#32698] [Ruby 1.9-Feature#3908][Open] private constant — Yusuke Endoh <redmine@...>
Feature #3908: private constant
10 messages
2010/10/05
[#32790] ruby with near native speed — Ondřej Bílka <neleai@...>
Hello
4 messages
2010/10/14
[#32795] Call for Cooperation: CFUNC usage survey — SASADA Koichi <ko1@...>
Hi,
5 messages
2010/10/15
[#32814] WeakHash — Santiago Pastorino <santiago@...>
Hi guys,
6 messages
2010/10/15
[#32844] [Ruby 1.9-Feature#3963][Open] Map class in standard library — Thomas Sawyer <redmine@...>
Feature #3963: Map class in standard library
3 messages
2010/10/18
[#32864] [Ruby 1.9-Bug#3972][Open] r28668 breaks test/unit when combined with the testing rake task — Aaron Patterson <redmine@...>
Bug #3972: r28668 breaks test/unit when combined with the testing rake task
6 messages
2010/10/20
[#32932] Behavior of initialize in 1.9 — Aaron Patterson <aaron@...>
The behavior of initialize in 1.9 seems to have changed. Here is an irb
5 messages
2010/10/28
[#32960] [Ruby 1.9-Bug#4005][Open] YAML fails to roundtrip Time objects — Peter Weldon <redmine@...>
Bug #4005: YAML fails to roundtrip Time objects
6 messages
2010/10/29
[#32976] Improve MinGW builds for Ruby 1.8.7, 1.9.2 and 1.9.3 — Luis Lavena <luislavena@...>
Hello,
10 messages
2010/10/30
[#32978] Re: Improve MinGW builds for Ruby 1.8.7, 1.9.2 and 1.9.3
— Aaron Patterson <aaron@...>
2010/10/30
On Sun, Oct 31, 2010 at 03:42:02AM +0900, Luis Lavena wrote:
[ruby-core:32730] Re: [Ruby 1.9-Feature#3845][Open] "in" infix operator
From:
"Martin J. Dst" <duerst@...>
Date:
2010-10-09 12:02:11 UTC
List:
ruby-core #32730
Hello Yusuke,
On 2010/10/08 21:29, Yusuke ENDOH wrote:
> Hi,
>
> 2010/10/8 "Martin J. Dst"<duerst@it.aoyama.ac.jp>:
>> I would understand that if it were [a, b, c].included? x
>> But it's include?, so the order seems just fine. Easy to read as
>> "does [a, b, c] include x?". Any other order would feel strange, wouldn't
>> it?
>
> I'm not talking about English, but a "subject" of a sentence.
> Because I think that the "subject" of this sentence is "x", I want to
> write "x" first, such as "is x included in [a, b, c]?".
[a, b, c] includes x, not the other way round. Of course, you can change
the verb to passive voice (includ*ed*) and make the former object (x) a
grammatical subject. But how do you expect people to deduce that you
think about it in the passive voice from the method name 'include'?
> Consider Python's join: '-'.join(["a", "b", "c"])
> I think that it is awkward NOT because it is unnatural English word order,
> but because an array (that is the "subject" of this sentence) appears
> later.
I think that you can both say "'-' joins the array" and "the array joins
itself with the '-'", so both Ruby and Python have a point. I think the
awkwardness (which I feel too) is mainly because we are used to Ruby,
not to Python.
>> Also, an 'in?' method on Object has been proposed, so that you can write
>> x.in? [a, b, c]
>> That's very short, and fully object oriented pure Ruby, no syntactic sugar
>> necessary.
>
> Some people say that it is against OO. They say that Object class should
> not have "in?" method because "in?" is not a property of Object.
Given that collections of various kinds are extremely important in
programming, it may not be too far-fetched to say that it's a property
of any Object in Ruby to be (potentially) included in a collection.
>>> 2) the idiom is too long (even though it is often used)
>>
>> I don't think Ruby method names are optimized according to usage frequency.
>
> Though there are many exceptions, Ruby certainly has a design principle
> ("akr theory" called in [ruby-dev:33558]) that encouraged methods should
> have short names.
Yes. Everything else being equal, that's a good policy to follow. But
Ruby naming doesn't go as far as dropping vowels and such the way Unix
commands do.
> An extreme example is [ruby-dev:33553]. matz once suggested String#sg
> that is a reformed version of String#gsub. Though it was not committed.
Good programmers know that program readability is important, and 'sg' is
definitely not readable.
>> Another way to do it would be:
>> case http_request.http_method
>> when :get, :post, :put, :delete
>> ...
>> end
>
> I agree that case statement is a good idea. When I imformally suggested
> "in?" operator (on IRC or twitter), some people also suggested me to use
> case statement, and I was satisfied once.
>
> But there is still two problems; case cannot be postpositive, and cannot
> be used in else clauses (like "elsif").
>
>
> An extreme example again: I heard that Sasada-san even created a patch for
> postpositive case statement:
>
> p "foo" case http_request.http_method when :get, :post, :put, :delete
>
> I believe that this shows that many people suffer from the word order
> problem, though "in" operator is much better than this syntax :-)
That case statement would in my view not be as bad as the 'in' proposal.
The case statement just completes the postpositive versions of
if/unless/while. The 'in' is a totally new construction.
Regards, Martin.
--
#-# Martin J. Dst, Professor, Aoyama Gakuin University
#-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp