[PD] Reason for not allowing '{' and '}' in Pd?

Christof Ressi christof.ressi at gmx.at
Mon May 14 13:43:11 CEST 2018


it's because these characters are special in Tcl and Pd currently doesn't try to escape them when sending them to the gui. you can still construct those characters on the Pd side (e.g. sending the ascii value to [list tosymbol]) but you can't type them. I also find this very annoying (you can't type JS, Lua or most other code in Pd) but from what I understood those characters are kept reserved because one day they might be turned into a feature (e.g. using {} for nested lists).
 
 

Gesendet: Montag, 14. Mai 2018 um 13:31 Uhr
Von: "Zack Lee" <cuinjune at gmail.com>
An: "Miller Puckette" <msp at ucsd.edu>, "PD List send" <pd-list at iem.at>
Betreff: [PD] Reason for not allowing '{' and '}' in Pd?

Hi, I'm trying to add a Lua scripting feature for my external which will allow users to write and run Lua scripts directly in pd as object arguments similar to how [expr] object works.
 
But the problem is curly brackets are used for table literals (e.g. a = {1, 2, 3}) in Lua, so it is not possible to create tables using this method.
I could only use '{' and '}' by editing the patch with a text editor, then reopening the patch in Pd.
 
I found this code inside canvas_key() function from "g_editor.c" file.
 

if (keynum == '\\' || keynum == '{' || keynum == '}')
    {
        post("keycode %d: dropped", (int)keynum);
        return;
    }
 
I would like to know why these 3 characters are not allowed in Pd.
Would there be any problem if we remove the above code from Pd?
Thanks!
 
Best regards,
Zack
 
 _______________________________________________ Pd-list at lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list



More information about the Pd-list mailing list