On Sat, 26 Mar 2005, Tim Blechmann wrote:
still, there is one problem ... what happens, if a symbol is sent through an outlet, is used somewhere else in the patch and the parent canvas with the specific $0 symbol table is deleted ... the symbol pointer would point into nowhere :-( ... will have to think about this
Ok, I reviewed all my stuff again, and I can say that there is currently no way to do what I want with the local symbols, because:
1. There is no way to store an instance number inside of the a_type field of an atom, because externals discard the atom and keep just the t_symbol*.
2. There is no way to store an instance number inside of a t_symbol* while keeping compatibility with the current code, because externals do dereference that pointer themselves instead of using an API, which means that the t_symbol* could not be replaced by (t_symbol*)(symbol_number*10000+canvas_number) for example.
3. There is no way to reference-count the t_symbols because the externals don't indicate their reference usage to pd.
4. There is no way to garbage-collect the t_symbols because the externals don't indicate to pd where are their t_symbol pointer variables located.
5. Integrating the $ number into the symbol and resolving it upon use (instead of upon declaration) makes no sense, as it breaks the feature of sending the name of a local name to some abstraction instance, by replacing it by a behaviour that is very difficult to use ($1's from completely different abstractions would get confused for each other...)
Which means that instead the road to be taken should be to create a new mechanism and slowly migrate everything to it, while keeping hackwards compatibility with the current way.
The new way I am now proposing (for the first time) would introduce a new atom type, a "pointer to variable", which would contain both a t_symbol* and an instance number.
Am I missing anything now?
_____________________________________________________________________ Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju