Hello,
Another example - perhaps somebody could fix that (many errors have that
source!)
Date.today
Date.today +1 # no error, but wrong result!
# Maybe this has been written for women, having calculated their age
Opti
Hello,
Another example - perhaps somebody could fix that (many errors have that
source!)
Date.today
Date.today +1 # no error, but wrong result!
# Maybe this has been written for women, having calculated their age
Opti
Hello,
Another example - perhaps somebody could fix that (many errors have that
source!)Date.today
Date.today +1 # no error, but wrong result!
Look at the docs
Which is the wrong result you get?
On Mon, Sep 27, 2021 at 2:54 PM Die Optimisten <inform@die-optimisten.net> wrote:
Which kind of wrong result do you get? For me (ruby 2.6.8), it seems to work
as expected:
Date.today.strftime
=> 2021-09-27
(Date.today+1).strftime
=> 2021-09-28
Stefano
On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
Hello,
Another example - perhaps somebody could fix that (many errors have that
source!)Date.today
Date.today +1 # no error, but wrong result!
# Maybe this has been written for women, having calculated their age
Opti
That's interesting, I think you mean the difference between a space makes
( +1 vs. + 1 ):
[14] pry(main)> Date.today
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[15] pry(main)> Date.today +1
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[16] pry(main)> Date.today + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
(btw: please don't make sexist comments, it's discouraging to many people.)
-gf-
On Mon, Sep 27, 2021 at 8:53 AM Die Optimisten <inform@die-optimisten.net> wrote:
Hello,
Another example - perhaps somebody could fix that (many errors have that
source!)Date.today
Date.today +1 # no error, but wrong result!
# Maybe this has been written for women, having calculated their age
Opti
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Parsing depends on the spaces:
Adding "one":
Date.today+1
Date.today_+_1
vs
Argument "one":
Date.today_+1
Date.today_1
Date.today(+1)
Date.today(1)
irb(main):013:0> (Date.today).strftime
=> "2021-09-27"
irb(main):014:0> (Date.today+1).strftime
=> "2021-09-28"
irb(main):015:0> (Date.today +1).strftime
=> "2021-09-27"
irb(main):016:0> (Date.today(+1)).strftime
=> "2021-09-27"
irb(main):017:0> (Date.today(1)).strftime
=> "2021-09-27"
irb(main):018:0> (Date.today 1).strftime
=> "2021-09-27"
$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today +1")'
s(:send,
s(:const, nil, :Date), :today,
s(:int, 1))
$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today+1")'
s(:send,
s(:send,
s(:const, nil, :Date), :today), :+,
s(:int, 1))
On 9/27/21, Stefano Crocco <stefano.crocco@alice.it> wrote:
On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
Date.today
Date.today +1 # no error, but wrong result!Which kind of wrong result do you get? For me (ruby 2.6.8), it seems to work
as expected:Date.today.strftime
=> 2021-09-27
(Date.today+1).strftime
=> 2021-09-28
The optional arg for Date.today(start=Date::ITALY) specifies a calendar
start date to use for calculation of today's date.
[43] pry(main)> Date.today()
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[44] pry(main)> Date.today(Date::ITALY)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[45] pry(main)> Date.today(Date::JULIAN)
=> #<Date: 2021-09-14 ((2459485j,0s,0n),+0s,Infj)>
# these are the same
[48] pry(main)> Date.today +1
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[49] pry(main)> Date.today(1)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
# these are the same
[51] pry(main)> Date.today + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
[52] pry(main)> Date.today() + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
-gf-
TIL: Dates are complicated, and even good tools have sharp edges.
On Mon, Sep 27, 2021 at 10:22 AM Frank J. Cameron <fjc@fastmail.net> wrote:
On 9/27/21, Stefano Crocco <stefano.crocco@alice.it> wrote:
> On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
>> Date.today
>> Date.today +1 # no error, but wrong result!
>
> Which kind of wrong result do you get? For me (ruby 2.6.8), it seems to
work
> as expected:
>
> Date.today.strftime
> => 2021-09-27
> (Date.today+1).strftime
> => 2021-09-28Parsing depends on the spaces:
Adding "one":
Date.today+1
Date.today_+_1vs
Argument "one":
Date.today_+1
Date.today_1
Date.today(+1)
Date.today(1)irb(main):013:0> (Date.today).strftime
=> "2021-09-27"
irb(main):014:0> (Date.today+1).strftime
=> "2021-09-28"irb(main):015:0> (Date.today +1).strftime
=> "2021-09-27"
irb(main):016:0> (Date.today(+1)).strftime
=> "2021-09-27"
irb(main):017:0> (Date.today(1)).strftime
=> "2021-09-27"
irb(main):018:0> (Date.today 1).strftime
=> "2021-09-27"$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today +1")'
s(:send,
s(:const, nil, :Date), :today,
s(:int, 1))$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today+1")'
s(:send,
s(:send,
s(:const, nil, :Date), :today), :+,
s(:int, 1))Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
I forgot to add, the invalid start day of 1 is silently being ignored...
that part seems problematic to me.
On Mon, Sep 27, 2021 at 10:42 AM Gerard Fowley <gerard.fowley@iqeo.net> wrote:
The optional arg for Date.today(start=Date::ITALY) specifies a calendar
start date to use for calculation of today's date.[43] pry(main)> Date.today()
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[44] pry(main)> Date.today(Date::ITALY)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[45] pry(main)> Date.today(Date::JULIAN)
=> #<Date: 2021-09-14 ((2459485j,0s,0n),+0s,Infj)># these are the same
[48] pry(main)> Date.today +1
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[49] pry(main)> Date.today(1)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)># these are the same
[51] pry(main)> Date.today + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
[52] pry(main)> Date.today() + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>TIL: Dates are complicated, and even good tools have sharp edges.
-gf-
On Mon, Sep 27, 2021 at 10:22 AM Frank J. Cameron <fjc@fastmail.net> > wrote:
On 9/27/21, Stefano Crocco <stefano.crocco@alice.it> wrote:
> On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
>> Date.today
>> Date.today +1 # no error, but wrong result!
>
> Which kind of wrong result do you get? For me (ruby 2.6.8), it seems to
work
> as expected:
>
> Date.today.strftime
> => 2021-09-27
> (Date.today+1).strftime
> => 2021-09-28Parsing depends on the spaces:
Adding "one":
Date.today+1
Date.today_+_1vs
Argument "one":
Date.today_+1
Date.today_1
Date.today(+1)
Date.today(1)irb(main):013:0> (Date.today).strftime
=> "2021-09-27"
irb(main):014:0> (Date.today+1).strftime
=> "2021-09-28"irb(main):015:0> (Date.today +1).strftime
=> "2021-09-27"
irb(main):016:0> (Date.today(+1)).strftime
=> "2021-09-27"
irb(main):017:0> (Date.today(1)).strftime
=> "2021-09-27"
irb(main):018:0> (Date.today 1).strftime
=> "2021-09-27"$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today +1")'
s(:send,
s(:const, nil, :Date), :today,
s(:int, 1))$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today+1")'
s(:send,
s(:send,
s(:const, nil, :Date), :today), :+,
s(:int, 1))Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
This is not related to the Date at all. It's a parser thing. Ruby is a language which takes a language syntax to its limit and beyond. It's one of not many with a very special meaning given to whitespaces.
[user@localhost sprockets]# ruby-parse -e 'x + 1'
(send
 (send nil :x) :+
 (int 1))
# ie: equivalent to x() + 1
[user@localhost sprockets]# ruby-parse -e 'x +1'
(send nil :x
 (int 1))
# ie. equivalent to x(+1)
[user@localhost sprockets]#
(note: ruby-parse is actually a part of an alternative implementation of a Ruby parser: GitHub - whitequark/parser: A Ruby parser. )
On 9/27/21 4:42 PM, Gerard Fowley wrote:
The optional arg for Date.today(start=Date::ITALY) specifies a calendar start dateto use for calculation of today's date.
[43] pry(main)> Date.today()
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[44] pry(main)> Date.today(Date::ITALY)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[45] pry(main)> Date.today(Date::JULIAN)
=> #<Date: 2021-09-14 ((2459485j,0s,0n),+0s,Infj)># these are the same
[48] pry(main)> Date.today +1
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[49] pry(main)> Date.today(1)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)># these are the same
[51] pry(main)> Date.today + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
[52] pry(main)> Date.today() + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>TIL: Dates are complicated, and even good tools have sharp edges.
-gf-
On Mon, Sep 27, 2021 at 10:22 AM Frank J. Cameron <fjc@fastmail.net > <mailto:fjc@fastmail.net>> wrote:
On 9/27/21, Stefano Crocco <stefano.crocco@alice.it > <mailto:stefano.crocco@alice.it>> wrote:
> On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
>> Date.today
>> Date.today +1Â Â # no error, but wrong result!
>
> Which kind of wrong result do you get? For me (ruby 2.6.8), it
seems to work
> as expected:
>
> Date.today.strftime
> => 2021-09-27
> (Date.today+1).strftime
> => 2021-09-28Parsing depends on the spaces:
Adding "one":
Date.today+1
Date.today_+_1vs
Argument "one":
Date.today_+1
Date.today_1
Date.today(+1)
Date.today(1)irb(main):013:0> (Date.today).strftime
=> "2021-09-27"
irb(main):014:0> (Date.today+1).strftime
=> "2021-09-28"irb(main):015:0> (Date.today +1).strftime
=> "2021-09-27"
irb(main):016:0> (Date.today(+1)).strftime
=> "2021-09-27"
irb(main):017:0> (Date.today(1)).strftime
=> "2021-09-27"
irb(main):018:0> (Date.today 1).strftime
=> "2021-09-27"$ ruby -r parser/current -e 'p
Parser::CurrentRuby.parse("Date.today +1")'
s(:send,
 s(:const, nil, :Date), :today,
 s(:int, 1))$ ruby -r parser/current -e 'p
Parser::CurrentRuby.parse("Date.today+1")'
s(:send,
 s(:send,
  s(:const, nil, :Date), :today), :+,
 s(:int, 1))Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
<mailto:ruby-talk-request@ruby-lang.org>?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>>Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Maybe the .today() method should test if arg == one_of(Date.constants
where class==Integer)
# how to write that in a nice (short) form in Ruby-code?
# perhaps enhance Ruby with above syntax?
Opti
Am 27.09.21 um 16:45 schrieb Gerard Fowley:
I forgot to add, the invalid start day of 1 is silently being
ignored... that part seems problematic to me.On Mon, Sep 27, 2021 at 10:42 AM Gerard Fowley <gerard.fowley@iqeo.net > <mailto:gerard.fowley@iqeo.net>> wrote:
The optional arg for Date.today(start=Date::ITALY) specifies a
calendar start dateto use for calculation of today's date.[43] pry(main)> Date.today()
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[44] pry(main)> Date.today(Date::ITALY)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[45] pry(main)> Date.today(Date::JULIAN)
=> #<Date: 2021-09-14 ((2459485j,0s,0n),+0s,Infj)># these are the same
[48] pry(main)> Date.today +1
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[49] pry(main)> Date.today(1)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)># these are the same
[51] pry(main)> Date.today + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
[52] pry(main)> Date.today() + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>TIL: Dates are complicated, and even good tools have sharp edges.
-gf-
On Mon, Sep 27, 2021 at 10:22 AM Frank J. Cameron > <fjc@fastmail.net <mailto:fjc@fastmail.net>> wrote:
On 9/27/21, Stefano Crocco <stefano.crocco@alice.it > <mailto:stefano.crocco@alice.it>> wrote:
> On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
>> Date.today
>> Date.today +1 # no error, but wrong result!
>
> Which kind of wrong result do you get? For me (ruby 2.6.8),
it seems to work
> as expected:
>
> Date.today.strftime
> => 2021-09-27
> (Date.today+1).strftime
> => 2021-09-28Parsing depends on the spaces:
Adding "one":
Date.today+1
Date.today_+_1vs
Argument "one":
Date.today_+1
Date.today_1
Date.today(+1)
Date.today(1)irb(main):013:0> (Date.today).strftime
=> "2021-09-27"
irb(main):014:0> (Date.today+1).strftime
=> "2021-09-28"irb(main):015:0> (Date.today +1).strftime
=> "2021-09-27"
irb(main):016:0> (Date.today(+1)).strftime
=> "2021-09-27"
irb(main):017:0> (Date.today(1)).strftime
=> "2021-09-27"
irb(main):018:0> (Date.today 1).strftime
=> "2021-09-27"$ ruby -r parser/current -e 'p
Parser::CurrentRuby.parse("Date.today +1")'
s(:send,
s(:const, nil, :Date), :today,
s(:int, 1))$ ruby -r parser/current -e 'p
Parser::CurrentRuby.parse("Date.today+1")'
s(:send,
s(:send,
s(:const, nil, :Date), :today), :+,
s(:int, 1))Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
<mailto:ruby-talk-request@ruby-lang.org>?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Hi!
(btw: please don't make sexist comments, it's discouraging to many
people.)-gf-
I have to describe this:
I think all girls would appreciate this;
I didn't write: Must have been added especially for not mentally
overstraining (some sort of blonde) girls ( 1+1=1 !!! ["no
contradiction allowed!"] ) -- sorry!
Opti :))
Talking about syntax (not about a possible solution, because Date is implemented in C and some of those constants are Floats; there also may be unrelated numeric constants):
one_of is include?, like [1,2,3].include? 3
where is select, like [1,2,3].select { |i| i > 1 }
So it could be written as:
#Â Â Â Â Â Â Â Â Â Â Â Â Â <- const names to values ---> <- get only integers --------> <- is arg in our array? ->
Date.constants.map { |i| Date.const_get(i) }.select { |i| i.is_a? Integer }.include? arg
Or maybe shorter:
Date.constants.any? { |i| Date.const_get(i) == arg }
As to the possible solution, IMO it should raise on invalid values.
On 9/27/21 7:02 PM, Die Optimisten wrote:
Maybe the .today() method should test if arg == one_of(Date.constants where class==Integer)
      # how to write that in a nice (short) form in Ruby-code?
      # perhaps enhance Ruby with above syntax?
OptiAm 27.09.21 um 16:45 schrieb Gerard Fowley:
I forgot to add, the invalid start day of 1 is silently being ignored... that part seems problematic to me.
On Mon, Sep 27, 2021 at 10:42 AM Gerard Fowley >> <gerard.fowley@iqeo.net <mailto:gerard.fowley@iqeo.net>> wrote:
Class: Date (Ruby 3.0.2)
<Class: Date (Ruby 3.0.2);The optional arg for Date.today(start=Date::ITALY) specifies a
calendar start dateto use for calculation of today's date.[43] pry(main)> Date.today()
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[44] pry(main)> Date.today(Date::ITALY)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[45] pry(main)> Date.today(Date::JULIAN)
=> #<Date: 2021-09-14 ((2459485j,0s,0n),+0s,Infj)># these are the same
[48] pry(main)> Date.today +1
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[49] pry(main)> Date.today(1)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)># these are the same
[51] pry(main)> Date.today + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
[52] pry(main)> Date.today() + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>TIL: Dates are complicated, and even good tools have sharp edges.
-gf-
On Mon, Sep 27, 2021 at 10:22 AM Frank J. Cameron >> <fjc@fastmail.net <mailto:fjc@fastmail.net>> wrote:
On 9/27/21, Stefano Crocco <stefano.crocco@alice.it >> <mailto:stefano.crocco@alice.it>> wrote:
> On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
>> Date.today
>> Date.today +1Â Â # no error, but wrong result!
>
> Which kind of wrong result do you get? For me (ruby 2.6.8),
it seems to work
> as expected:
>
> Date.today.strftime
> => 2021-09-27
> (Date.today+1).strftime
> => 2021-09-28Parsing depends on the spaces:
Adding "one":
Date.today+1
Date.today_+_1vs
Argument "one":
Date.today_+1
Date.today_1
Date.today(+1)
Date.today(1)irb(main):013:0> (Date.today).strftime
=> "2021-09-27"
irb(main):014:0> (Date.today+1).strftime
=> "2021-09-28"irb(main):015:0> (Date.today +1).strftime
=> "2021-09-27"
irb(main):016:0> (Date.today(+1)).strftime
=> "2021-09-27"
irb(main):017:0> (Date.today(1)).strftime
=> "2021-09-27"
irb(main):018:0> (Date.today 1).strftime
=> "2021-09-27"$ ruby -r parser/current -e 'p
Parser::CurrentRuby.parse("Date.today +1")'
s(:send,
 s(:const, nil, :Date), :today,
 s(:int, 1))$ ruby -r parser/current -e 'p
Parser::CurrentRuby.parse("Date.today+1")'
s(:send,
 s(:send,
  s(:const, nil, :Date), :today), :+,
 s(:int, 1))Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
<mailto:ruby-talk-request@ruby-lang.org>?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>>Unsubscribe:<mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
I think that from a developer experience perspective, this is an
interesting combination of parser flexibility re space and punctuation,
method default values, and the Date.today() method's arg checking.
FWIW Date.today does check and issue a warning about ignoring the invalid
start value:
#define val2sg(vsg,dsg) \
do {\
dsg = NUM2DBL(vsg);\
if (!c_valid_start_p(dsg)) {\
dsg = DEFAULT_SG;\
rb_warning("invalid start is ignored");\
}\
} while (0)
While development tooling may catch this (RuboCop ?) I am surprised this is
not an ArgumentError exception.
Interestingly some Ruby bug tracker issues that mention Date,today have
flirted with some combination of contributing factors but I don't see any
that bring them all together:
-gf-
On Mon, Sep 27, 2021 at 1:02 PM Die Optimisten <inform@die-optimisten.net> wrote:
Maybe the .today() method should test if arg == one_of(Date.constants
where class==Integer)
# how to write that in a nice (short) form in Ruby-code?
# perhaps enhance Ruby with above syntax?
OptiAm 27.09.21 um 16:45 schrieb Gerard Fowley:
I forgot to add, the invalid start day of 1 is silently being ignored...
that part seems problematic to me.On Mon, Sep 27, 2021 at 10:42 AM Gerard Fowley <gerard.fowley@iqeo.net> > wrote:
The optional arg for Date.today(start=Date::ITALY) specifies a calendar
start date to use for calculation of today's date.[43] pry(main)> Date.today()
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[44] pry(main)> Date.today(Date::ITALY)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[45] pry(main)> Date.today(Date::JULIAN)
=> #<Date: 2021-09-14 ((2459485j,0s,0n),+0s,Infj)># these are the same
[48] pry(main)> Date.today +1
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)>
[49] pry(main)> Date.today(1)
=> #<Date: 2021-09-27 ((2459485j,0s,0n),+0s,2299161j)># these are the same
[51] pry(main)> Date.today + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>
[52] pry(main)> Date.today() + 1
=> #<Date: 2021-09-28 ((2459486j,0s,0n),+0s,2299161j)>TIL: Dates are complicated, and even good tools have sharp edges.
-gf-
On Mon, Sep 27, 2021 at 10:22 AM Frank J. Cameron <fjc@fastmail.net> >> wrote:
On 9/27/21, Stefano Crocco <stefano.crocco@alice.it> wrote:
> On lunedì 27 settembre 2021 14:53:22 CEST Die Optimisten wrote:
>> Date.today
>> Date.today +1 # no error, but wrong result!
>
> Which kind of wrong result do you get? For me (ruby 2.6.8), it seems
to work
> as expected:
>
> Date.today.strftime
> => 2021-09-27
> (Date.today+1).strftime
> => 2021-09-28Parsing depends on the spaces:
Adding "one":
Date.today+1
Date.today_+_1vs
Argument "one":
Date.today_+1
Date.today_1
Date.today(+1)
Date.today(1)irb(main):013:0> (Date.today).strftime
=> "2021-09-27"
irb(main):014:0> (Date.today+1).strftime
=> "2021-09-28"irb(main):015:0> (Date.today +1).strftime
=> "2021-09-27"
irb(main):016:0> (Date.today(+1)).strftime
=> "2021-09-27"
irb(main):017:0> (Date.today(1)).strftime
=> "2021-09-27"
irb(main):018:0> (Date.today 1).strftime
=> "2021-09-27"$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today
+1")'
s(:send,
s(:const, nil, :Date), :today,
s(:int, 1))$ ruby -r parser/current -e 'p Parser::CurrentRuby.parse("Date.today+1")'
s(:send,
s(:send,
s(:const, nil, :Date), :today), :+,
s(:int, 1))Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe> <ruby-talk-request@ruby-lang.org?subject=unsubscribe><http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
You're in the wrong here. Take the loss, own up to it, and do better next
time.
On Mon, Sep 27, 2021, 12:15 PM Die Optimisten <inform@die-optimisten.net> wrote:
Hi!
> (btw: please don't make sexist comments, it's discouraging to many
> people.)
>
> -gf-I have to describe this:
I think all girls would appreciate this;
I didn't write: Must have been added especially for not mentally
overstraining (some sort of blonde) girls ( 1+1=1 !!! ["no
contradiction allowed!"] ) -- sorry!Opti :))
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
> (btw: please don't make sexist comments, it's discouraging to many
people.)
What's next? Don't make enterprise java jokes / comments, it's
discouraging to many people.
Cancel culture is going too far. The intended joke is harmless
and your comment is discouraging - yes, keep your language police
comments to yourself.
Hello,
While I am at it...
Yes, how about making me feel welcome hypocrites, eh?
I am a long time open.source ruby contributor. Bring on the hate
(or the warm and fuzzy feeling).
Cheers. Prost.
If you make jokes that hurt other people feelings, maybe you should have
taken the opportunity and kept your mouth shut. Or at least apologise.
Labeling it as 'cancel culture' makes no sense. The world always had jerks
and people always have put them into their place, and this is what is
happening right now.
PS: don't forget to turn off your automatic e-mail notifications when on
vacation for the Ruby mailing list. I know it is typical in Germany, but
mostly only in Germany. It looks silly elsewhere. The whole mailing list
doesn't care if you are on vacation (in German).
On Tue, 28 Sept 2021 at 14:33, Gerald Bauer <gerald.bauer@gmail.com> wrote:
Hello,
While I am at it...
Yes, how about making me feel welcome hypocrites, eh?
I am a long time open.source ruby contributor. Bring on the hate
(or the warm and fuzzy feeling).Cheers. Prost.
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Thanks to all you who contribute
Thanks for some of the humor
Some I can do without, but that's my choice....no Christmas card for you, kinda thing
There are enough REAL issues in the world, in our problem space, let's not confuse it with
 people trying to tell others how they are supposed to act....remember, the crowd used to like
 to burn witches too...the majority agreed....
Again---thanks for the valuable Ruby contributions of so many of you...I continue to learn....
I come here to learn about the language and algorithms....
all else is of no import.....
Blonde jokes rock.
cj:)
On 9/28/2021 7:43 PM, Thiago Massa wrote:
If you make jokes that hurt other people feelings, maybe you should have taken the opportunity and kept your mouth shut. Or at least apologise.
Labeling it as 'cancel culture' makes no sense. The world always had jerks and people always have put them into their place, and this is what is happening right now.
PS: don't forget to turn off your automatic e-mail notifications when on vacation for the Ruby mailing list. I know it is typical in Germany, but mostly only in Germany. It looks silly elsewhere. The whole mailing list doesn't care if you are on vacation (in German).
On Tue, 28 Sept 2021 at 14:33, Gerald Bauer <gerald.bauer@gmail.com > <mailto:gerald.bauer@gmail.com>> wrote:
Hello,
  While I am at it...
  Yes, how about making me feel welcome hypocrites, eh?
  I am a long time open.source ruby contributor.  Bring on the hate
(or the warm and fuzzy feeling).  Cheers. Prost.
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
<mailto:ruby-talk-request@ruby-lang.org>?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk
<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.ruby-lang.org%2Fcgi-bin%2Fmailman%2Foptions%2Fruby-talk&data=04|01||4ae8f736c6ff49ac1b3308d9827dab25|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637684298511743885|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=wlmBlbKTNJLBE2MLJHVvSjX28eCLLpuTDnXCsW%2FuZB0%3D&reserved=0>>Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
If you can't set a good example,
be a glaring warning.
There's a certain set of universal corporate values that you are expected to follow and *enforce* if you are financially, emotionally or otherwise dependent on a company or organization that subscribes to those values. *It's a waste of time* to argue about those values, because they are already set in stone by the respective corporate departments. If you personally subscribe to a different set of values and feel in conflict, the best course of action is to work on eliminating those dependencies whenever possible and encouraging your loved ones to do so as well.
On 9/28/21 2:26 PM, Gerald Bauer wrote:
(btw: please don't make sexist comments, it's discouraging to many
people.)
What's next? Don't make enterprise java jokes / comments, it's
discouraging to many people.Cancel culture is going too far. The intended joke is harmless
and your comment is discouraging - yes, keep your language police
comments to yourself.Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
For myself, I am a big fan of the "MINASWAN" doctrine in Ruby,
Matz Is Nice And So We Are Nice.
If someone wants to argue a lot ... maybe time to switch to Python
On Tue, Sep 28, 2021 at 9:25 AM hmdne <hmdne@airmail.cc> wrote:
There's a certain set of universal corporate values that you are expected
to follow and *enforce* if you are financially, emotionally or otherwise
dependent on a company or organization that subscribes to those values. *It's
a waste of time* to argue about those values, because they are already
set in stone by the respective corporate departments. If you personally
subscribe to a different set of values and feel in conflict, the best
course of action is to work on eliminating those dependencies whenever
possible and encouraging your loved ones to do so as well.
On 9/28/21 2:26 PM, Gerald Bauer wrote:(btw: please don't make sexist comments, it's discouraging to many
people.)
What's next? Don't make enterprise java jokes / comments, it's
discouraging to many people.Cancel culture is going too far. The intended joke is harmless
and your comment is discouraging - yes, keep your language police
comments to yourself.Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe> <ruby-talk-request@ruby-lang.org?subject=unsubscribe><http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
A musician must make music, an artist must paint, a poet must write, if he
is to be ultimately at peace with himself.
- Abraham Maslow
For myself, I am a big fan of the "MINASWAN" doctrine in Ruby,
Matz Is Nice And So We Are Nice.
These days I read and post very rarely on ruby-talk but keep the
subscription (maybe some form of nostalgia?). This community used to be
very friendly most of the time and I find it a bit sad that the same sorts
of conflicts start to pop up here as well that we see elsewhere. I guess,
we cannot escape general trends in society. I would love though if we could
keep as much of the friendliness as possible and also retain the occasional
humor.
If someone wants to argue a lot ... maybe time to switch to Python
Kind regards
robert
On Tue, Sep 28, 2021 at 7:24 PM Sean Felipe Wolfe <ether.joe@gmail.com> wrote:
--
[guy, jim, charlie, sho].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/