Limited Number of method arguments?

Alan Kay Alan.Kay at disney.com
Mon Dec 13 16:33:52 UTC 1999


Part of the long ago idea here was that objects are a better solution than
passing lots of params -- both as receivers (the instance variables should
allow far fewer params to methods, and as a param value (which may contain
lots of values)).

Cheers,

Alan

------

At 7:42 AM -0800 12/13/99, Donald T. Major, II wrote:
>It's an implementation detail of convenience: it allows a bytecode to refer to
>an argument in the current stackframe using 4 bits, often encoded within the
>byte itself (if I recall correctly).  The usual way to write Smalltalk methods
>of more than 15 arguments is to pass collections or other objects containing
>multiple values.
>
>It might sound cumbersome and painful, but if you study some of the method
>sources in the system, you'll see some elegant looking code accomplishes
>quite a
>lot using relatively few arguments.
>
>Ivan Brusic wrote:
>
>> Udo Schneider wrote:
>> >
>> > Does Squeak have a limitation regarding
>> > the number of arguments passed to a method?
>> >
>> > I'm using 2.7alpha and got an error message
>> > 'Too Arguments' by trying to pass more than
>> > 15 arguments.
>>
>> Yes, Squeak methods are limited to 15 arguments.  The limitation is set
>> in the Encoder>>bindArg: method.  I do not know why/how the number 15
>> was chosen, but it is hardcoded in the sources.
>>
>> I have encountered the same problem and my solution was to use multiple
>> methods with a smaller number of arguments and then cascade the
>> messages.  In some cases, I made each method have one argument and used
>> 15+ cascades.
>>
>> Ivan
>>
>> --
>>
>> Ivan Brusic                    |  "Computers are nothing but a perfect
>> E-mail: ibrusic at wsicorp.com    |   illusion of order" - Iggy Pop
>> Phone: (978) 262-0758          |
>
>--
> ..  Donald Major @ unx.sas.com   System Developer    677-8000, x6937
>dtm  System Developer             SAS Institute Inc
>http://www.unx.sas.com/~sasdtm/
>"Remember those stats that compare the life spans of men vs. women,
>married vs.
> unmarried men, etc.? Has anyone analyzed Mac vs. Wintel users?"-Stephen
>Yanusz
>
>
>Content-Type: text/x-vcard; charset=us-ascii;
> name="sasdtm.vcf"
>Content-Transfer-Encoding: 7bit
>Content-Description: Card for Donald T. Major, II
>Content-Disposition: attachment;
> filename="sasdtm.vcf"
>
>Attachment converted: Macintosh HD:sasdtm.vcf 2 (TEXT/ttxt) (00010AC7)





More information about the Squeak-dev mailing list