[#70977] [Ruby trunk - Feature #11473] Immutable String literal in Ruby 3 — arai@...
Issue #11473 has been updated by Shunichi Arai.
3 messages
2015/10/04
[#70982] limiting scope of magic comments like frozen_string_literal — Eric Wong <normalperson@...>
How about being able to limit the scope of magic comments like
4 messages
2015/10/05
[#71062] [Ruby trunk - Bug #10892] Deadlock in autoload — eregontp@...
Issue #10892 has been updated by Benoit Daloze.
4 messages
2015/10/12
[#71090] Re: [Ruby trunk - Bug #10892] Deadlock in autoload
— Eric Wong <normalperson@...>
2015/10/14
eregontp@gmail.com wrote:
[#71127] [Ruby trunk - Feature #11607] [PATCH] fiddle: release GVL for ffi_call — normalperson@...
Issue #11607 has been updated by Eric Wong.
3 messages
2015/10/20
[#71164] [Ruby trunk - Feature #11614] [Open] [RFC] use id_table for constant tables — normalperson@...
Issue #11614 has been reported by Eric Wong.
3 messages
2015/10/22
[#71211] [Ruby trunk - Feature #11607] [PATCH] fiddle: release GVL for ffi_call — naruse@...
Issue #11607 has been updated by Yui NARUSE.
6 messages
2015/10/27
[#71212] Re: [Ruby trunk - Feature #11607] [PATCH] fiddle: release GVL for ffi_call
— Eric Wong <normalperson@...>
2015/10/27
Yes, user must check if the function is MT-safe. Probably fine
[#71246] Re: [Ruby trunk - Feature #11607] [PATCH] fiddle: release GVL for ffi_call
— Aaron Patterson <tenderlove@...>
2015/10/28
On Tue, Oct 27, 2015 at 08:54:07AM +0000, Eric Wong wrote:
[#71254] Re: [Ruby trunk - Feature #11607] [PATCH] fiddle: release GVL for ffi_call
— Eric Wong <normalperson@...>
2015/10/28
Aaron Patterson <tenderlove@ruby-lang.org> wrote:
[#71230] [Ruby trunk - Feature #11625] Unlock GVL for SHA1 calculations — tenderlove@...
Issue #11625 has been updated by Aaron Patterson.
5 messages
2015/10/27
[#71236] Re: [Ruby trunk - Feature #11625] Unlock GVL for SHA1 calculations
— Юрий Соколов <funny.falcon@...>
2015/10/28
What's about other hashsum algos? MD5, SHA2, etc
[#71242] Re: [Ruby trunk - Feature #11625] Unlock GVL for SHA1 calculations
— Eric Wong <normalperson@...>
2015/10/28
Юрий Соколов <funny.falcon@gmail.com> wrote:
[#71239] [Ruby trunk - Bug #11384] multi-threaded autoload sometimes fails — shugo@...
Issue #11384 has been updated by Shugo Maeda.
4 messages
2015/10/28
[ruby-core:71198] [Ruby trunk - Bug #11621] [Rejected] Date.- and Date.+ methods inconsistencies
From:
shugo@...
Date:
2015-10-27 00:51:17 UTC
List:
ruby-core #71198
Issue #11621 has been updated by Shugo Maeda.
Status changed from Open to Rejected
Andrei Balcanasu wrote:
> Good point, but this still does not explain why in some cases ` -7` works:
>
> ```ruby
> now = Date.today
> => #<Date: 2015-10-26 ((2457322j,0s,0n),+0s,2299161j)>
> now -7
> => #<Date: 2015-10-19 ((2457315j,0s,0n),+0s,2299161j)>
If `x` is a reference to a local variable, `x -y` is interpreted as `x - y`.
Otherwise, `x -y` is interpreted as `x(-y)`.
def x(y)
:x
end
p(x -2) #=> :x
x = 1
p(x -2) #=> -1
This behavior is irrelevant to `Date`, so if you don't like it, please file another ticket.
----------------------------------------
Bug #11621: Date.- and Date.+ methods inconsistencies
https://bugs.ruby-lang.org/issues/11621#change-54576
* Author: Andrei Balcanasu
* Status: Rejected
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
I noticed today some inconsistencies when using `-` and `+` methods of the `Date` class, that makes the whitespace relevant:
~~~
irb(main):001:0> require 'date'
=> true
irb(main):002:0> Date.today - 7
=> #<Date: 2015-10-19 ((2457315j,0s,0n),+0s,2299161j)>
irb(main):003:0> Date.today -7
=> #<Date: 2015-10-26 ((2457322j,0s,0n),+0s,2299161j)>
irb(main):004:0> Date.today-7
=> #<Date: 2015-10-19 ((2457315j,0s,0n),+0s,2299161j)>
~~~
It looks like the parser ignores the `-7` in the context of `Date.today` instead of interpreting it as `7 days ago`
This can be replicated when using integers as variables:
~~~
irb(main):002:0> days = 5
=> 5
irb(main):003:0> p (Date.today - days) == (Date.today -days)
false
=> false
~~~
or when creating `Date` with `DateTime.now`, but weirdly enough not when the `Date` is in a variable:
~~~
irb(main):004:0> now = Date.today
=> #<Date: 2015-10-26 ((2457322j,0s,0n),+0s,2299161j)>
irb(main):005:0> p (now - 7) == (now-7)
true
=> true
irb(main):006:0> p (now -7) == (now-7)
true
=> true
~~~
or when creating a `Date` with the constructors that force you to set a date (`new`, `ordinal`, `parse`, etc)
The other thing that I discovered while testing this was the behaviour `to_date` when tried to chain the `-` method:
~~~
irb(main):002:0> Time.new(2001,2,3).to_date
=> #<Date: 2001-02-03 ((2451944j,0s,0n),+0s,2299161j)>
irb(main):003:0> Time.new(2001,2,3).to_date -7
ArgumentError: wrong number of arguments (1 for 0)
from (irb):3:in `to_date'
from (irb):3
from /opt/boxen/rbenv/versions/2.2.3/bin/irb:11:in `<main>'
irb(main):004:0> Time.new(2001,2,3).to_date - 7
=> #<Date: 2001-01-27 ((2451937j,0s,0n),+0s,2299161j)>
~~~
I've attached a file with my tests and commented the output from my machine.
---Files--------------------------------
date.rb (1.41 KB)
--
https://bugs.ruby-lang.org/