1Date: Tue, 6 Feb 2001 20:27:37 -0600 (CST) 2From: Chris Lattner <sabre@nondot.org> 3To: Vikram S. Adve <vadve@cs.uiuc.edu> 4Subject: Type notation debate... 5 6This is the way that I am currently planning on implementing types: 7 8Primitive Types: 9type ::= void|bool|sbyte|ubyte|short|ushort|int|uint|long|ulong 10 11Method: 12typelist ::= typelisth | /*empty*/ 13typelisth ::= type | typelisth ',' type 14type ::= type (typelist) 15 16Arrays (without and with size): 17type ::= '[' type ']' | '[' INT ',' type ']' 18 19Pointer: 20type ::= type '*' 21 22Structure: 23type ::= '{' typelist '}' 24 25Packed: 26type ::= '<' INT ',' type '>' 27 28Simple examples: 29 30[[ %4, int ]] - array of (array of 4 (int)) 31[ { int, int } ] - Array of structure 32[ < %4, int > ] - Array of 128 bit SIMD packets 33int (int, [[int, %4]]) - Method taking a 2d array and int, returning int 34 35 36Okay before you comment, please look at: 37 38http://www.research.att.com/~bs/devXinterview.html 39 40Search for "In another interview, you defined the C declarator syntax as 41an experiment that failed. However, this syntactic construct has been 42around for 27 years and perhaps more; why do you consider it problematic 43(except for its cumbersome syntax)?" and read that response for me. :) 44 45Now with this syntax, his example would be represented as: 46 47[ %10, bool (int, int) * ] * 48 49vs 50 51bool (*(*)[10])(int, int) 52 53in C. 54 55Basically, my argument for this type construction system is that it is 56VERY simple to use and understand (although it IS different than C, it is 57very simple and straightforward, which C is NOT). In fact, I would assert 58that most programmers TODAY do not understand pointers to member 59functions, and have to look up an example when they have to write them. 60 61In my opinion, it is critically important to have clear and concise type 62specifications, because types are going to be all over the programs. 63 64Let me know your thoughts on this. :) 65 66-Chris 67 68