![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
The lack of sleep has been getting to me, and it's been making my dreams weird. So I shared a brief snippet of a dream with a friend:
<Afuna> earrlier I had a dream where I was debuginging, and the problem/solution was that it did not have any undernwear
<Afuna> not sure what "it" is :-)
<PauAmma> Probably better left unexplored. :-)
<Afuna> yes. indeed
<Afuna> I woke up right after realizeng that :0
<PauAmma> (although I gotta ask: what were the symptoms?)
<Afuna> don't really remember.
<Afuna> I remember reading the code, but I don't remember waht I was looking for
<PauAmma> Something like $it->remove(@underwear)?
<Afuna> hah! nothing so simple as that
<Afuna> but I wish :-)
<Afuna> now I wonder what the context of that function would be
<Afuna> (I'm *dying* here just so you know :P)
* PauAmma chuckles.
<Afuna> brilliant
* Afuna claps
<Afuna> (what happens when there is indeed no underwear?)
<PauAmma> Outer foreach is never executed. :-)
<Afuna> so unlike in my dream, yours doesn't have the "but there's no underwear" bug? :-)
<PauAmma> Not at this stage. It could, if you expect $it->underwear to return a non-empty array. :-)
<PauAmma> If you expect a later call to..., that is.
<Afuna> hmm. I'd expect that doff actually removes the underwear, though, so $it->underwear should be empty after he call to $it->remove?
<Afuna> (PS. almost accidentally sent taht to the channel)
<PauAmma> Depends on what you pass to remove. If you do $person->remove($person->underwear), yes. But you could do $person->remove($person->socks), for instance.
<PauAmma> *snicker*
<Afuna> wht happens if you do $person->remove($otherperson->underwear)?
* Afuna tries to puzzle it out
<Afuna> oh wait
<PauAmma> Hmm, good point. *looks at code*
<Afuna> hm. so you undo teh clasps of the other's garment, but then try to remove the garment from yourself? :-P
<PauAmma> Probably needs a call to $otherperson->get_permission somewhere. And yes, need to take that into account.
<Afuna> ah, yes.
<Afuna> did not consider the need for permission. Was only thinking of a context where permission is implied by the situation, but yeah that's not always the csae
<PauAmma> We can handle that with a suitable class hierarchy, I think.
<Afuna> hmm. not sure wheer to start with that
<Afuna> s/wheer/where/
<PauAmma> Or polymorphic objects, maybe.
<Afuna> earrlier I had a dream where I was debuginging, and the problem/solution was that it did not have any undernwear
<Afuna> not sure what "it" is :-)
<PauAmma> Probably better left unexplored. :-)
<Afuna> yes. indeed
<Afuna> I woke up right after realizeng that :0
<PauAmma> (although I gotta ask: what were the symptoms?)
<Afuna> don't really remember.
<Afuna> I remember reading the code, but I don't remember waht I was looking for
<PauAmma> Something like $it->remove(@underwear)?
<Afuna> hah! nothing so simple as that
<Afuna> but I wish :-)
<Afuna> now I wonder what the context of that function would be
<PauAmma> # Assumes underwear is sorted in over-to-under order
<PauAmma> sub remove {
<PauAmma> my $self = shift;
<PauAmma> foreach my $garment (@_) {
<PauAmma> $garment->undo($_) foreach ($garment->clasps);
<PauAmma> $self->doff($garment);
<PauAmma> }
<PauAmma> }
<Afuna> (I'm *dying* here just so you know :P)
* PauAmma chuckles.
<Afuna> brilliant
* Afuna claps
<Afuna> (what happens when there is indeed no underwear?)
<PauAmma> Outer foreach is never executed. :-)
<Afuna> so unlike in my dream, yours doesn't have the "but there's no underwear" bug? :-)
<PauAmma> Not at this stage. It could, if you expect $it->underwear to return a non-empty array. :-)
<PauAmma> If you expect a later call to..., that is.
<Afuna> hmm. I'd expect that doff actually removes the underwear, though, so $it->underwear should be empty after he call to $it->remove?
<Afuna> (PS. almost accidentally sent taht to the channel)
<PauAmma> Depends on what you pass to remove. If you do $person->remove($person->underwear), yes. But you could do $person->remove($person->socks), for instance.
<PauAmma> *snicker*
<Afuna> wht happens if you do $person->remove($otherperson->underwear)?
* Afuna tries to puzzle it out
<Afuna> oh wait
<PauAmma> Hmm, good point. *looks at code*
<Afuna> hm. so you undo teh clasps of the other's garment, but then try to remove the garment from yourself? :-P
<PauAmma> Probably needs a call to $otherperson->get_permission somewhere. And yes, need to take that into account.
<Afuna> ah, yes.
<Afuna> did not consider the need for permission. Was only thinking of a context where permission is implied by the situation, but yeah that's not always the csae
<PauAmma> We can handle that with a suitable class hierarchy, I think.
<Afuna> hmm. not sure wheer to start with that
<Afuna> s/wheer/where/
<PauAmma> Or polymorphic objects, maybe.
no subject
Date: 2007-10-20 06:32 am (UTC)