[PD-dev] some tclpd questions/comments

mescalinum at gmail.com mescalinum at gmail.com
Mon Nov 7 23:43:20 CET 2011


Il 07/11/2011 23:25, Hans-Christoph Steiner ha scritto:
> I'm just trying my hand at writing my first tclpd library, 'tclfile', which is basically all of the individual subcommands of Tcl's 'file' command broken out as separate objects.

cheers!

>   This has given rise to a couple questions/comments:
>
> - do I need to use proc+ or can I just use proc?

proc+ is defined in tclpd.tcl as follows:

     proc proc+ {name arglist body} {
         set body2 [concat "global _;" [regsub -all @(\\\$?\[\\w\\?\]+) 
$body _(\$self:\\1)]]
         uplevel #0 [list proc $name $arglist $body2]
     }

it allows you to have per instance ($self) object variables, like you 
usually have fields in the t_yourobject struct when coding externals in 
C (always have the first method argument called 'self'!)

>
> - it seems like the 'constructor' proc is the same as Pd's setup() function.  If so, I think it should also be called 'setup'.

it is not the setup function.
maybe it is the _new() function

>
> - is there an 0_anything/A_GIMME proc that can be used?

yes
check examples/dynreceive.tcl

>
> - multi-level namespaces to represent library and classname?  Something like tclfile/mkdir would be tclfile::mkdir and have tclfile::mkdir::constructor.

didn't think of that, and right now it is not possible (the calling 
mechanism is hardcoded in c as ::<classname>::method)


>
> .hc
>
>
> ----------------------------------------------------------------------------
>
> I spent 33 years and four months in active military service and during that period I spent most of my time as a high class muscle man for Big Business, for Wall Street and the bankers.      - General Smedley Butler
>
>




More information about the Pd-dev mailing list