Oldes / Rebol-wishes

Repository for keeping Rebol related wishes out of issues
0 stars 0 forks source link

Wish: Way to combine DATE! and TIME! without a variable #1

Closed Siskin-Bot closed 3 years ago

Siskin-Bot commented 4 years ago

Submitted by: Hostilefork

I'd like to be able to make a date from values that are by-products of calculation without naming them, e.g.:

>> make date! compose [(11-Dec-2012 + 1) (10:00 + 00:20)]
== 12-Dec-2012/10:20

That doesn't work today, but I was curious about if paths could be used to compose dates. This weird behavior is in both Rebol2 and R3-Alpha, due to something probably related to Oldes/Rebol-issues#2283:

>> time: 10:20
>> 12-Dec-2012/(time)
== 10:20

But if you try to use pathing to set the time of a date that doesn't work (should it?)

>> time: 10:20
>> date: 12-Dec-2012
>> date/(time)
** Script error: cannot access (time) in path date/(time)

This, however, does work:

>> t: 10:20
>> d: 12-Dec-2012
>> d/time: t
== 10:20
>> d
12-Dec-2012/10:20

(Note: That's a little weird seeming, because it gives the appearance of mutating a date, when it actually mutated the word containing the date...since you can't change immediate values...kind of odd.)

Still, that doesn't meet my wish because in order to use it, I have to name something and do a path operation. I'd like something more like the MAKE DATE! to put the pieces together with.


Imported from: https://github.com/rebol/rebol-issues/issues/2313

Comments:


Hostilefork added the Type.wish on Jun 15, 2018


Hostilefork added a commit to metaeducation/ren-c that referenced this issue on Jun 15, 2018: Eliminate rebTimeHMS(), rebDateYMD(), rebDateTime()