Yes, but only certain values can be passed to some primitives since the primitives usually only understand 32 bit integers, Tim is pointing out integers can be much bigger than you think. In fact for this usage you can wait until the universe reaches heat death if you can keep a machine running that long, assuming the fix for delay where delay is a really big number is in the image you are using (Mantis bug 854).
I'll note a link to some old code, a server/client I wrote a few years back http://www.smalltalkconsulting.com/html/OTNotes3.html
The pattern here is to setup up a process that waits say 15 minutes for an connection to occur. If it occurs then we used a shared queue to place a work request object on. A lower priority task is waiting on the work queue and will then wake up and do what is required. As long as the stopRunning flag is not set we loop endlessly in this pattern. This allows us to easily terminate the listen process since it must wake up every 15 minutes (or what ever you choose) to check the flag and do other housekeeping.
buildListenProcess
self buildListenSocket. self listenProcess: ([[self stopRunning not] whileTrue: [self acceptRequests]] forkAt: Processor userInterruptPriority)
acceptRequests | request |
request _ self listenSocket waitForAcceptUntil: (Socket deadlineSecs: self secondsToWaitForListen). request isConnected ifTrue: [self incrementNumberIncoming. self incomingRequests nextPut: (JMMNetWorkRequest newWithSocket: request)]
secondsToWaitForListen ^15*60
buildListenSocket | server |
server _ Socket newTCP. server listenOn: self listenPort backlogSize: self backLogMessageSize. server isValid ifFalse:[self error:'Accept() is not supported']. self listenSocket: server.
On Apr 27, 2005, at 9:44 AM, Tim Rowledge wrote:
François THIMON thimof@iutc3.unicaen.fr wrote:
the largest integer I can write in this language).
You might be surprised just how big that is; a LargePositiveInteger can be as big as memory (roughly, anyway) which on an OS with virtual memory etc can turn out to be awfully large.
Just for an amusing illustration, try
7000 factorial
and 'print it'. It will take a while, but nearly all the time is taken by the printing part. It's a 900+ byte LPI with 23878 digit decimal value
700 factorial is a lot smaller and faster to handle, being merely 1690 digits.
tim
Tim Rowledge, tim@sumeru.stanford.edu, http://sumeru.stanford.edu/tim Avoid GOTOs completely if you can to keep the program readable.
-- ======================================================================== === John M. McIntosh johnmci@smalltalkconsulting.com 1-800-477-2659 Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com ======================================================================== ===