----- Original Message -----
From: IOhannes zmölnig zmoelnig@iem.at To: pd-dev@iem.at Cc: Sent: Saturday, January 12, 2013 9:27 AM Subject: Re: [PD-dev] from t_symbol to t_class
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).
and avoiding code duplication.
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.
Well yes. I meant searching for a class and _returning_ a class pointer.
So without adding/revising code inside class_new, is creating an instance the only way to get access to the class attributes?
-Jonathan
fgmasdr IOhannes
Pd-dev mailing list Pd-dev@iem.at http://lists.puredata.info/listinfo/pd-dev