On Tue, Dec 2, 2008 at 7:26 PM, bearophile <[EMAIL PROTECTED]> wrote: > Bill Baxter: > >>What about Perl shows that auto-flattening is bad?< > > > You can find a note here: > http://steve.yegge.googlepages.com/ancient-languages-perl >> > Larry decided to flatten lists by default. Hence, if you write this: > @x = (1, 2, 3, (4, 5)); > It automagically turns into (1, 2, 3, 4, 5). > <
Wow, I guess it really has been a long time for me and Perl. Don't recall that little quirk at all. > The ability of creating trees with arbitrary nested tuples/arrays is really > handy (I don't know if the variant type of Tango allows to do this. The boxed > of Phobos doesn't allow it, I think). > >>Isn't there an easier way to fake it using structs?< > > In my dlibs I've added a Record/record that can be used a little as a Python > tuple, the Record can be found here: > http://www.fantascienza.net/leonardo/so/dlibs/templates.html Hmm, but just to play devils advocate here, you've implemented it, BCS implemented, and I implemented it again this morning. That would seem to argue that the current state is fine, the unflattenable tuple type just needs to be in the standard lib(s) so people don't have to keep rolling their own. (Personally I agree non-flattening would be better and argued for it soon after Tuples came out, but somehow I doubt Walter's going to be convinced to break a significant amount of Tuple-using template code without a more ... convincing argument. Something like a demonstration of some of BCS's compile-time parser written with and without auto-flattening tuples showing a dramatic reduction in code for the no-flattening case.) --bb
