[squeak-dev] Re: #valueWithEnoughArguments: vs #valueWithPossibleArgs: ?

David Goehrig dave at nexttolast.com
Sat Jul 25 12:21:42 UTC 2009


On Sat, Jul 25, 2009 at 7:37 AM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:

> Yeah, I discovered these strange customs with
> http://bugs.squeak.org/view.php?id=7352
> To me, the whole API looks hackish and messy, but it seems to be used,
> so will be hard to remove...


The reason they're used is that they are the easiest way to create methods
which do the right thing with optional parameters. Now perhaps the "right
thing" to do would be add a feature to the parser that allowed methods to
"degrade" such that:

foo:withBar:andNarf:

can be

foo:withBar:

and

foo:

or event possibly

foo

rather than having to write 4 separate methods.  It is incredibly useful
when you have say block closures stuck in a dictionary that has the block
closures swapped out based on the behavior of those blocks.  Where would you
ever use such at thing?  Poker playing AI!  Seriously, if you're
implementing a system that can play a game like "Follow the Queen" , the
rules of the game change based on what cards are showing.  The easiest way
to implement this is to swap out  individual rules when some events happen.


But discussions like this go nowhere fast :)  For example:

http://www.cincomsmalltalk.com/userblogs/rademers/blogView?showComments=true&entry=3285925252


and

http://www.smalltalk.org/articles/article_20050216_a1.html

actually its a shame the discussion hasn't been more vigorous :)

Dave


-=-=-=-=-=-=-=-=-=-=- http://blog.dloh.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090725/a6edf660/attachment.htm


More information about the Squeak-dev mailing list