[Newbies] Binary file I/O performance problems
Randal L. Schwartz
merlyn at stonehenge.com
Tue Sep 2 23:04:40 UTC 2008
>>>>> "David" == David Finlayson <dfinlayson at usgs.gov> writes:
David> ((((a notNil and: [ b notNil ]) and: [ c notNil ])) and: [ d notNil])
David> ifTrue:
David> [ n := a.
David> n := (n bitShift: 8) + b.
David> n := (n bitShift: 8) + c.
David> n := (n bitShift: 8) + d ]
David> ifFalse: [ n := nil ].
This screams for an "early answer" assistant method, something like:
computeSomething
a isNil: [^nil].
b isNil: [^nil].
c isNil: [^nil].
d isNil: [^nil].
^(the code with all the bitshifts).
Actually, perhaps even the use of a good detect: would be right here, if you
didn't have a, b, c, d as instvars. In fact, that's much more likely an array
instead of four instvars, which would simplify all the repeated code.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
More information about the Beginners
mailing list