SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

Mantis - Squeak
Viewing Issue Advanced Details
7107 Kernel minor always 07-03-08 11:07 04-18-10 22:05
SergeStinckwich  
nicolas cellier  
normal  
closed 3.10.2  
fixed  
none    
none trunk  
0007107: 1 printStringBase: 1 generates an infinite loop within Integer>>printStringBase:
Integer>>printStringBase: should be corrected to complain if its argument (base) is less than 2. Fix by Oscar include.
related to 0006710new  fix for the Method Finder from Ted Kaehler 
related to 0006887closed nicolas cellier Faster printString for LargeInteger 
has duplicate 0006724closed  printStringBase: should be protected against wrong bases 
 Integer-printStringBase.st [^] (608 bytes) 07-03-08 11:07

Notes
(0012323)
nicolas cellier   
07-03-08 15:05   
Thank you for the patch Serge, but mind not tri-plicating bug reports.
I warned you two mails above in squeak-dev that bug is already reported
at http://bugs.squeak.org/view.php?id=6724 [^]
and http://bugs.squeak.org/view.php?id=6710 [^]

See also http://bugs.squeak.org/view.php?id=6887 [^] for a more efficient printStringBase: algorithm.

Cheers
(0012324)
nicolas cellier   
07-03-08 19:30   
0006887 is not only more efficient, it fails when feeded with a bad base.

Error Message is not explicit though...
However i find it very boring to assert preconditions.
Why not do it in each and every method ?
1) because we would prevent unknown future extensions to work
2) because we should not spoil efficiency of kernel methods, and printString is a good candidate for tight loop sends.

I would personnally prefer a good comment about base argument prerequisite and a good old Smalltakj-style Debugger session...

So I recommend my personal patch, if of course agreed by the community.
(0012332)
matthewf   
07-04-08 01:55   
From 0006724:

self should: [2 printStringBase: 1] raise: Error.
   "it does infinite loop"

"Found that in methodFinder with 2. 1. 3."


"Funnily, you can even print in non integer base"
(Float pi printStringBase: Float pi). '10.0'.

(0012333)
matthewf   
07-04-08 01:57   
From nicolas cellier, in 0006724:
IMO the patch should be superseded by 0006887 which does not loop infinitely and which offers a much faster printString / printOn: / printStringBase: / etc...
(0013326)
nicolas cellier   
10-03-09 20:25   
This is resolved in trunk by inclusion of 0006887