On 01/12/2013 12:04 AM, Jonathan Wilkes wrote:
In C would I just make a struct with fields of t_symbol,

t_class, and a pointer to link to the next one?


Yeah, a linked list would work fine, probably not as efficient as the c++ hash 
structure (but lots easier to maintain).  One nit-to-pick:  Use a t_class 
pointer, which is a t_pd.


Hm... since the code to add new classes to the list will probably
end up looking exactly like the code to add symbols to the
symbol table, what if I just bloat the _symbol struct by adding
a t_class *s_class?  Would that affect performance?

it would break binary compatibility.

there's no good reason to add hash-like lookups to t_symbol (your only reason is convenience). true, there's an s_thing there, but that's mainly for performance reasons (looking up symbol->class mappings is usually outside a performance critical path)(and having s_thing in t_symbol is very ugly)



Then searching for an existing class would be easy-- just do
a gensym and check if its s_class exists.


but checking whether a class exists, is as simple as calling zgetfn on pd_objectmaker.
i think this is _quite_ easy.


fgmasdr
IOhannes

_______________________________________________
Pd-dev mailing list
Pd-dev@iem.at
http://lists.puredata.info/listinfo/pd-dev

Reply via email to