numberten / zhenya_bot

irc bot and official Haskell feature creep
Other
5 stars 1 forks source link

!alias: nonexistent aliases are shown to be in their own cluster #33

Closed numberten closed 10 years ago

numberten commented 10 years ago

!alias <nick that doesn't exist> returns that alias as if it were in its own cluster. ex:

16:54 <@will> !alias jesse
16:54 <@zhenya_bot> jesse, jesse_, jesse_phone, jesse_phone3
16:55 <@jesse> !alias jessee
16:55 <@zhenya_bot> jessee
fimad commented 10 years ago

I think we may want to reconsider this. There is definitely a use case for having an unknown nick's cluster be itself. For instance, when integrating with grep we consider all of the nicks in the given nick's cluster. It would be odd and lead to unexpected behavior if a given nick was not in it's own cluster.

numberten commented 10 years ago

You're referring to the case where a nick is in the history but not in a nickcluster? Possibly after being manually removed?

fimad commented 10 years ago

Yes.

numberten commented 10 years ago

It still seems kind of weird, even with this case where it might save lines of code. Returning the unknown nick doesn't give the caller any information other than representing failure. If it were changed to return Maybe [Nicks], the component could still make use of its argument (in this example unknown-nick) in the Nothing case.

Functionally they're the same, but in my opinion representing failure with Nothing is more elegant than forcing the component implementer to explicitly check to see if aliasesForNick returned its own argument.