Limited Number of method arguments?

Donald T. Major, II sasdtm at unx.sas.com
Mon Dec 13 15:42:14 UTC 1999


--------------7EEB4F19DFC4569F49A6C666
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


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


--------------7EEB4F19DFC4569F49A6C666
Content-Type: text/plain; name="sasdtm.vcf"
 ; x-mac-type="54455854"
 ; x-mac-creator="522A6368"
Content-Disposition: attachment; filename="sasdtm.vcf"
Content-Transfer-Encoding: imap_stub

0,2313,2,375,14,

--------------7EEB4F19DFC4569F49A6C666--





More information about the Squeak-dev mailing list