Sharp Smalltalk Class Library

The class library provided by #Smalltalk is mostly compatible with the ANSI Smalltalk standard. A couple exceptions to that are with DateAndTime and Duration. Since both of these use standard .NET classes for their representation, they have some limitations on their values. The DateAndTime class can only represent values between January 1, 0001 and December 31, 9999, and the Duration class can only represent values between -10675199:02:48:05.4775808 and 10675199:02:48:05.4775807 (that’s 10,675,199 days).

Another difference between #Smalltalk and the ANSI standard Smalltalk is with indexed instance variables. #Smalltalk does not have indexed instance variables. If you want indexed instance variables, you need to include a real instance variable that contains an array or byte array.

While the library provided by #Smalltalk is compatible with the ANSI standard, it sometimes works differently than other Smalltalks. One of the main differences is with identity comparisons. While most Smalltalks use tagged SmallIntegers, the #Smalltalk compiler uses objects to represent SmallIntegers. Therefore, “1 + 1 == 2” evaluates to false in #Smalltalk.

Another difference in the class library provided by #Smalltalk is with the #initialize method. In most Smalltalks when you define an instance method #initialize, you must also specify a #new method that sends the #initialize method. This results in many classes implementing #new as “super new initialize”. In #Smalltalk, the #new method in Object already sends the #initialize method. The #initialize method is defined as an empty method. This allows you to simply override the #initialize method without having to worry about overriding the #new method. Furthermore, if also allows you to remove many duplicate #new methods throughout the class library. However, if you are porting software from another Smalltalk to #Smalltalk, you will need to remove the “super new initialize” #new methods. Otherwise, you will have #initialize being sent multiple times.

Contact Us

  • 1-217-344-4847
  • info@teamsthatinnovate.com

About Us

Teams that Innovate offers high-level, customized consulting and mentoring services to industry leading companies. Our goal is to hasten the improvement of your core development teams, empowering them to innovate, grow, and develop clean, functional code.

Copyright © 2013 - Present, All Rights Reserved.