Re: Enhancement request
"Martyn J. Pearce" <[email protected]> Sun, 13 Mar 2005 12:26:58 +0000
| Newsgroups | gmane.comp.lang.perl.modules.class-methodmaker |
|---|---|
| Message-ID | <[email protected]> |
Hi Rob,
Apologies again for the delay in replying. [is this related to your other
question about hash init?].
I see that a workaround was posted at perlmonks, which is cool.
I also see that others posted the very same point I will make: what you're
proposing breaks the implicit contract; which is that by providing a default,
the value will always be set. I dread to think how changing that would affect
things, beyond breaking that guarantee. You say yourself that you understand
the design decision, which at least makes me feel sane :-); but I can't see
how any other way could be consistent.
I appreciate that you're asking for an override button, which is a reasonable
thing, but then, the more overrides we add, the more complex the code gets.
As you've seen, it's already a long way there... [mostly for v1 compatibility,
that is].
Mx.
On Fri, Feb 11, 2005 at 12:49:03PM -0500, Rob Kinyon wrote:
> I'm using 2.05 on Solaris with Perl 5.8.4, standard build.
>
> I've got the following code:
>
> use Class::MethodMaker [
> new => 'new',
> scalar => [
> { -type => 'Some::Class', -default_ctor => 'new' },
> 'some_class',
> ],
> ];
>
> I'd like to be able to specify something that would allow for the
> following test to pass:
>
> $object->some_class_reset();
> ok(
> !$object->some_class_isset(),
> "I just reset the damn thing, so it shouldn't be set yet!",
> );
>
> Currently, the code in scalar.pm says that if a default is specified,
> the attribute is consider to be always set, even if it isn't actually
> set yet.
>
> I understand the design decision behind this, but I'd like to be able
> to override it, if possible.
>
> Thanks,
> Rob Kinyon
>
> p.s. I posted about this on Perlmonks at
> http://www.perlmonks.org/?node_id=430184
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Class-mmaker-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/class-mmaker-devel
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click