Skip Menu |

This queue is for tickets about the Class-Std CPAN distribution.

Report information
The Basics
Id: 15427
Status: rejected
Priority: 0/
Queue: Class-Std

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Class::Std v0.0.4, upon perl 5.8.4, Linux Sorry, last one (I hope). I'm only reporting this because in the PBP, you talk about building an API that behaves like one would expect. If one uses the "init_arg" tag, that attribute becomes required at instantiation. I would expect it to be optional. If not supplied that attribute is undefined. Instead, I'm forced to do: my %name : ATTR( :init_arg<name> :get<name> :default<undef> ); To make the attribute optional. Thanks Jay
Date: Tue, 01 Nov 2005 11:56:27 -0500
To: bug-Class-Std [...] rt.cpan.org
Subject: Re: [cpan #15427]
From: Damian Conway <thoughtstream [...] gmail.com>
RT-Send-Cc:
Show quoted text
> Sorry, last one (I hope). I'm only reporting this because in the PBP, > you talk about building an API that behaves like one would expect.
Yes, but I also talk about not allowing variables to go uninitialized. Show quoted text
> If one uses the "init_arg" tag, that attribute becomes required at instantiation. > I would expect it to be optional. If not supplied that attribute is undefined.
I consciously chose to make such arguments required, so the user is... Show quoted text
>...forced to do: > > my %name : ATTR( :init_arg<name> :get<name> :default<undef> ); >
In other words if you specify that an attribute can be initialized, I want you to be explicit about what should happen if it isn't. I can certainly see your point about expectations, but that convenience has to be balanced with the desirability of being explicit about default behaviours. I chose to require explicitness (because I believe that improves the robustness of the resulting code). All the best, Damian