How do you transform an instance of the old type to the new type?

On Thu, Feb 4, 2016 at 9:27 PM, Cedric St-Jean <cedric.stj...@gmail.com>
wrote:

> One could do a deepcopy-like traversal of everything starting from the GC
> roots and replace all instances of the old type with the new type...
> Obviously a very costly operation, but it might be cool to offer that in a
> package.
>
> On Thursday, February 4, 2016 at 6:34:00 PM UTC-5, Stefan Karpinski wrote:
>>
>> That would mean that redefining a type of which there are any (reachable)
>> instances would invalidate the entire system. That seems significantly
>> worse than simply not allowing types to be redefined without restarting.
>> One could potentially make references to "invalidated" objects #undef, but
>> that seems likely to leave the object graph in a completely unusable state.
>>
>> On Thu, Feb 4, 2016 at 6:11 PM, Michael Landis <darksky...@gmail.com>
>> wrote:
>>
>>> They would be invalid too.  I know... no garbage collector, so it would
>>> be necessary to find the inbound references.  Smart pointers maybe?  Yet
>>> another performance hit.
>>>
>>> On Thursday, February 4, 2016 at 1:54:24 PM UTC-8, Stefan Karpinski
>>> wrote:
>>>>
>>>> How does one "release" an object? What happens to other objects that
>>>> retain references to those objects?
>>>>
>>>> On Thu, Feb 4, 2016 at 4:35 PM, Michael Landis <darksky...@gmail.com>
>>>> wrote:
>>>>
>>>>> if you added a field, the existing objects could still be valid.  If
>>>>> you killed an attribute, they are invalid and can be released.
>>>>>
>>>>> On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski
>>>>> wrote:
>>>>>>
>>>>>> What happens to existing objects of a type when you redefine the type?
>>>>>>
>>>>>> On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis <darksky...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I think it would be nice to be able to undefine a type, so
>>>>>>> restarting the environment is not required when adding or deleting an
>>>>>>> attribute from a type description.  Not being able to update a type
>>>>>>> definition without restarting the environment is a royal pain in the 
>>>>>>> ass.
>>>>>>>
>>>>>>>
>>>>>>> On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>>>>>>>>
>>>>>>>> Suppose I have a Type
>>>>>>>>
>>>>>>>> type Foo
>>>>>>>>   a
>>>>>>>>   b
>>>>>>>> end
>>>>>>>>
>>>>>>>> f = Foo(1,2)
>>>>>>>> f.a = 1
>>>>>>>> f.b = 2
>>>>>>>>
>>>>>>>> how do I test whether f.a is defined
>>>>>>>> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>>>>>>>>
>>>>>>>> another question
>>>>>>>> how do i undefine f.a such that isdefined(f,1) now returns false
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>

Reply via email to