[Glass] Comment of #newDay:monthNumber:year: is wrong (and I do not like the behavior either!)

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Fri Aug 7 13:24:26 PDT 2015


Mariano,

Since the creation of a date is a primitive call, the official fix will 
be in C code (I think) ...  it looks like there is no validation for the 
day of the month, so a straight forward Smalltalk patch should be 
possible ...

Dale

On 08/07/2015 01:18 PM, Mariano Martinez Peck wrote:
> Thanks Dale. If a back port or workaround is easy for 3.1.0.7 I would 
> appreciate that too.... I don't expext an official release... but 
> maybe a workaround. I do not even care if I have to put it as an 
> override as part of my packages... Of course...I can write myself the 
> validation of ranges too...
> But seems to me it sounds like a big bug... all users of such a method 
> could have been getting a shifted date if they did not send a correct 
> one...
>
> On Fri, Aug 7, 2015 at 5:10 PM, Dale Henrichs via Glass 
> <glass at lists.gemtalksystems.com 
> <mailto:glass at lists.gemtalksystems.com>> wrote:
>
>     Mariano,
>
>     Thanks for the report, I've submitted an internal bug (45525) on
>     this against 3.2.7 and 3.3.
>
>     Dale
>
>
>     On 08/07/2015 06:35 AM, Mariano Martinez Peck via Glass wrote:
>>     Hi guys,
>>
>>     Just for the record, the comment of:
>>
>>     Date class >> newDay: day monthNumber: month year: year
>>
>>     *"*Creates and returns an instance of the receiver from the
>>     specified values.
>>     * Generates an error if any of the values are out of range."*
>>
>>     Is wrong since it does not throws and error and instead shifts
>>     the day. Example:
>>
>>     Date newDay: 31 monthNumber: 6 year: 2015 -> 07/01/2015   (June
>>     has only 30 days)
>>
>>     BTW... This is a frustrating behavior for me. Pharo would
>>     correctly throw a DateError, but GemStone shifts and gives me
>>     back another date. This could lead to problems quite hard to debug.
>>
>>     Cheers,
>>
>>
>>     -- 
>>     Mariano
>>     http://marianopeck.wordpress.com
>>
>>
>>     _______________________________________________
>>     Glass mailing list
>>     Glass at lists.gemtalksystems.com  <mailto:Glass at lists.gemtalksystems.com>
>>     http://lists.gemtalksystems.com/mailman/listinfo/glass
>
>
>     _______________________________________________
>     Glass mailing list
>     Glass at lists.gemtalksystems.com <mailto:Glass at lists.gemtalksystems.com>
>     http://lists.gemtalksystems.com/mailman/listinfo/glass
>
>
>
>
> -- 
> Mariano
> http://marianopeck.wordpress.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150807/897b3750/attachment-0001.html>


More information about the Glass mailing list