At 02:51 PM 3/13/2002 +0000, Tim Bunce wrote:
>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.

With more overhead on object creation though.

new, set, set, set...

"Encoding" and "autochomp" might fall into the language specific
category, then I would agree about implementing a method for each.

Memory footprint and dimensions are common to most languages,
so to me, it makes more sense as a constructor.

-Melvin

Reply via email to