On Wed, Mar 13, 2002 at 09:03:13AM -0500, Dan Sugalski wrote: > I like the fact that we're adding an arg to init to decide how big to > make the resulting PMC. It got me to thinking, though. Perhaps we'd > be even better served if we passed in something a bit more complex. > > We are, after all, likely to get something like this at the perl level: > > my Str @foo is dim(10, 10, 10), encoding "Shift-JIS", > max_len(40), autochomp; > > or something sort of like that. We'd really like to pass in the dim, > encoding, max_len, and autochomp to the init method, so it can init > things properly.
You're presuming that a single 'init' *should* look after all that. That doesn't seem very practical or extensible etc. I recall Larry saying something (roughly) along the lines that attributes, like the above, could be thought of, and possibly implemented as, method/function calls on the variable/value. That seems like a much more extensible approach. Perhaps some kind of variable/value init framework is needed and maybe an 'init' will play a part in that. But if so, I think the init probably shouldn't have knowledge of what encoding, max_len, and autochomp *mean*, it should just make the method/function calls. There's obviously a whole bunch of potential ordering issues. I'd be tempted to stick to the "they're just method/function calls on the variable" approach as far as possible. Tim. p.s. And for some reason I'm reminded of Larry's reminder not to confuse variables with values.