On Sun, Mar 13, 2016 at 10:28:19PM +0100, Levente Uzonyi wrote:
On Sun, 13 Mar 2016, David T. Lewis wrote:
Apologies, this is not right. I was replying from a cell phone and my recollection was wrong.
I did at one point implement a #primitiveUtcWithOffset that could receive an array of size two as an argument into which the result values are stored, instead if allocating the array in the primitive. However, I did *not* commit it to VMMaker, and it is not in any currently available VMs.
I think I decided at the time that this approach was dangerous because it would invite problems in cases involving multiple processes, where some other process might call the primitive using the same array. In that case the time value in the array would magically change without the first process being aware.
That could only happen if the Array would be shared by multiple processes. For example if there were a dedicated class variable to retrieve the values from the VM, but that would be nothing but bad design.
Well yes, but bad design is a very common failure mode ;-)
Why I thought that the argument should be of any Object with two slots is that this would allow us to use the DateAndTime instance itself to fetch the values into. Or anyone could come up with their own class to store timestamps and still be able to use this primitive.
That is absolutely brilliant! What a great idea.
DateAndTime class>>now ^self basicNew initializeFromPrimitive
Dave