Title: RE: Class::FakeAttributes -- Opinions Wanted
> That said, I've given up on automating non-trivial
> accessors/mutators.
I wouldnt say that I've given up, but I dont think ive ever used any of the class based method generaotrs beside Class::Struct and even not
On Fri, Nov 07, 2003 at 11:02:34AM +0100, A. Pagaltzis wrote:
> Even disregarding these differences, your code needs a lot of
> additions before it becomes useful in practice. The most glaring
> definiciency is that there's no provision for deleting an object
> instance's data from the hash on obje
* Fergal Daly <[EMAIL PROTECTED]> [2003-11-07 10:46]:
> I think you're misunderstanding the purpose of my code.
I understood quite well what it does; it was a misunderstanding
on the level of what I think an ::InsideOut module should do vs
what you intended your piece of code to do.
Even disregar
On Thu, Nov 06, 2003 at 05:58:25PM +0100, A. Pagaltzis wrote:
> Read it too. My point is that the method would be accessible from
> a much broader scope (ie globally, really) than would the
> attribute hash in Yves' code (stricly local to the method).
Yes, _all_ methods are globally accessible.
A
* Orton, Yves <[EMAIL PROTECTED]> [2003-11-06 19:41]:
> Well, maybe there are ways around the problems mentioned
> before. I think there are. Im just not sure yet.
>
> Yves
Definitely. I have ideas for some of them. I just have more
important work to do for the time being..
--
Regards,
Aristotl
Title: RE: Class::FakeAttributes -- Opinions Wanted
> $ perl -Mstrict -wle 'my $f = { }; my @a = @{ $f->{foo} }'
> Can't use an undefined value as an ARRAY reference at -e line 1.
Exactly my point. Stick that _expression_ in a for loop however...
D:\&g
Title: RE: Class::FakeAttributes -- Opinions Wanted
> * Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:27]:
> > Thats because the apporach you are comparing it to is flawed.
> >
> > foreach (@{$self->{foo}||[]}) { ... }
> >
> >
* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2003-11-04 12:30]:
> use My::OutOfBandLexicalThing qw( Attr Attr2 Attr3 );
>
> and you'd get lexically scoped, overload worry free, out of
> band attrs without any bothersome typing.
* A. Pagaltzis <[EMAIL PROTECTED]> [2003-11-06 18:00]:
> I'm not interest
* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2003-11-04 12:30]:
> I'm guessing you didn't read my code because it was based on
> Yves'. Yves showed a single accessor method called inside_out,
> you complained that it would requir lots of typing of refaddr
> to use that for every attribute in the class
On Tue, Nov 04, 2003 at 11:18:36AM +0100, A. Pagaltzis wrote:
> * [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2003-11-04 10:49]:
> > What else do you mean by "tightly scoped"?
>
> Something like this:
>
> * Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:34]:
> > use Scalar::Util qw(refaddr);
> >
>
* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2003-11-04 10:49]:
> What else do you mean by "tightly scoped"?
Something like this:
* Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:34]:
> use Scalar::Util qw(refaddr);
>
> {
>my %attrib;
>sub inside_out {
> my $s=shift;
> if (
On Mon, Nov 03, 2003 at 07:56:57PM +0100, A. Pagaltzis wrote:
> Not really. The idea would be to (be able to) have attributes
> stored in tightly scoped lexical hashes.. which doesn't seem
> doable other than by a source filter (ick!).
I'm not really sure what you mean by that but the code I provi
darren chamberlain writes:
> * A. Pagaltzis [2003-11-03 17:38]:
>
> > * Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:27]:
> > >
> > > > If the 'foo' attribute hasn't been set to anything, then you
> > > > want an empty list to iterate over. With version C, that's
> > > > what you get.
> > >
Orton, Yves writes:
> > (There's equivalent reasoning behind the existence of
> > push_attribute().)
>
> But in this case its unwarranted.
>
> my $foo=undef;
> push @$foo,"Bar";
> print "@$foo\n";
But if the undef is returned from a function, the autovivification only
happens to the loca
[EMAIL PROTECTED] writes:
> How about Class::SafeAttributes. Because you can safely add
> atrributes.
Except, as Aristotle notes, it isn't really that safe.
I wouldn't like to use that name and mislead people into thinking their
code is safer than it really is.
> Compared to FakeAttributes, it'
A. Pagaltzis writes:
> * Smylers <[EMAIL PROTECTED]> [2003-11-03 00:40]:
>
> > ... safety isn't really the point --
> > Wx::StaticBoxSizer can safely be inherited from,
>
> Well, you can't safely store your own attributes in a $self hashref
> provided by a superclass;
True, but that's 'normal'
* darren chamberlain <[EMAIL PROTECTED]> [2003-11-03 19:42]:
> $ perl -Mstrict -wle 'my $f = { }; my @a = @{ $f->{foo} }'
> Can't use an undefined value as an ARRAY reference at -e line 1.
Oi. I'm getting the autovivification stuff mixed up.. (A good
sign that Perl DWIMs so well that I rarely
* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2003-11-03 19:42]:
> Wouldn't this do what you want (roughly, it may not actually
> compile...)
Not really. The idea would be to (be able to) have attributes
stored in tightly scoped lexical hashes.. which doesn't seem
doable other than by a source filter (
* A. Pagaltzis [2003-11-03 17:38]:
> * Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:27]:
> > > If the 'foo' attribute hasn't been set to anything, then you
> > > want an empty list to iterate over. With version C, that's
> > > what you get.
> >
> > No. If $self->{foo} is undef you get an err
From: A. Pagaltzis [EMAIL PROTECTED]
> And then there's accessor/mutator generation.. ie what
> ::MethodMaker does. Which there seems to be no easy way to do
> (with lexicals) using inside out objects..
Wouldn't this do what you want (roughly, it may not actually compile...)
use Scalar::Util qw(r
* Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:27]:
> Thats because the apporach you are comparing it to is flawed.
>
> foreach (@{$self->{foo}||[]}) { ... }
>
> is the correct way to spell that I think.
Actually, no. See below.
> > If the 'foo' attribute hasn't been set to
* Orton, Yves <[EMAIL PROTECTED]> [2003-11-03 17:34]:
> in hind site implementing an inside out object/attribute is so
> easy (its pretty small, heres what I use for good general
> coverage:)
>
> use Scalar::Util qw(refaddr);
>
> {
>my %attrib;
>sub inside_out {
> my $s=shift;
Title: RE: Class::FakeAttributes -- Opinions Wanted
> I guess in the absence of Class::InsideOut, having
> Class::OutOfBandAttributes as a band-aid isn't a bad idea.
> (There's a lot of orders of magnitude less useful stuff out on
> CPAN..)
Primary problem with creat
Title: RE: Class::FakeAttributes -- Opinions Wanted
> That's intended. I'll make this as clear as I can: My module is not
> intended to be a general implementation for people who want inside-out
> objects!
I cant help but observing that perhaps it should be. Kills y
How about Class::SafeAttributes. Because you can safely add atrributes.
Compared to FakeAttributes, it's more descriptive of the purpose rather
than the implementation,
F
Original Message:
-
From: Smylers [EMAIL PROTECTED]
Exactly. They're 'fake' in that they aren't considered p
* Smylers <[EMAIL PROTECTED]> [2003-11-03 00:40]:
> > An actually implementation agnostic name would probably be
> > something like ::SafeInheritance. (Which it isn't completely
> > though, but see below.)
>
> Possibly. But safety isn't really the point --
> Wx::StaticBoxSizer can safely be inher
A. Pagaltzis writes:
> * Smylers <[EMAIL PROTECTED]> [2003-11-02 18:05]:
>
> > However, even now I know the name for the technique I don't
> > think it'd be appropriate to call the module
> > Class::InsideOutAttributes (or similar), because that is
> > describing the module's implementation rathe
* Smylers <[EMAIL PROTECTED]> [2003-11-02 18:05]:
> A. Pagaltzis writes:
> > This has been invented by Abigail quite a while ago and is
> > called "inside out objects". See
> > http://www.perlmonks.org/index.pl?node_id=219378
>
> Thanks for that. Knowing that Abigail has used this technique
> giv
* Smylers <[EMAIL PROTECTED]> [2003-11-02 18:05]:
> However, even now I know the name for the technique I don't
> think it'd be appropriate to call the module
> Class::InsideOutAttributes (or similar), because that is
> describing the module's implementation rather than the
> situation in which it
A. Pagaltzis writes:
> * Smylers <[EMAIL PROTECTED]> [2003-10-31 10:55]:
>
> > http://search.cpan.org/perldoc?Class::FakeAttributes
>
> This has been invented by Abigail quite a while ago and is called
> "inside out objects". See
> http://www.perlmonks.org/index.pl?node_id=219378
Thanks for t
* Smylers <[EMAIL PROTECTED]> [2003-10-31 10:55]:
> I've uploaded it to Cpan as somewhere to put it for discussion:
>
> http://search.cpan.org/perldoc?Class::FakeAttributes
This has been invented by Abigail quite a while ago and is called
"inside out objects". See
http://www.perlmonks.org/index
Yesterday I was subclassing Wx::StaticBoxSizer (for reasons that don't
matter here) and found that, because it's based on a scalar ref rather
than the more-usual hash ref, I couldn't store more data inside the
objects. So I wrote Class::FakeAttributes to work round this and
pretend to myself that
32 matches
Mail list logo