This is an old revision of the document!


Release Notes for PDFtalk (PDF4Smalltalk 2.0)

This is the release of the second major version of the PDF library.

Some changes are incompatible with the previous version, which are describe here.

Smalltalk classes representing a PDF type should not be referenced directly anymore. Instead an expression like

PDF classAt: <PDF type symbol>

shhould be used.

Example

(PDF classAt: #Contents) "returns class PDFtype.Contents"

Often used classes can be accessed through a shortcut method:

PDF String.     "returns class PDFtalk.PDFString"
PDF Array.      "returns class PDFtalk.PDFArray"
PDF Dictionary. "returns class PDFtalk.PDFDictionary"
PDF Stream.     "returns class PDFtalk.PDFStream"
PDF Page.       "returns class PDFtalk.Page"

There are 2 reasons for this * PDF type and Smalltalk class names may not be the same anymore * The Smalltalk class name may differ in different ports of the library.

The shared variable PDF was added to the Smalltalk namespace. The variable holds the class PDFtalk.PDF which serves as general entry point for the library.

Unless you extend the library, there should be no need to add the PDFtalk namespace to the imports of your project. Instead most functionality should be accessed through PDF in the Smalltalk namespace.

The new typing system allowed to remove the PDF classes Null and Boolean. Instead, they are now implemented by the system classes UndefinedObject and Boolean.

Boxing (with #asPDF) and unboxing (with #asSmalltalkValue) is not necessary anymore for nil, true and false. Instead, the Smalltalk objects are used directly.

The work is not finished yet. Number and maybe String and Date could be aligned as well.

The major change is the redesign of the PDF typing system. Initially, I represented the types of PDF objects by Smalltalk classes with the same name. This turned out to be not sufficient.

Firstly, PDF types form a different hierarchy than the Smalltalk classes implementing them. Both hierarchies cannot be represented in a single inheritance class hierarchy at the same time.

Secondly, the PDF type names are tied to class names. A class cannot be renamed without changing the PDF types. This has been a problem for porting the libary to other Smalltalk dialects.

Therefore, PDF types are now modeled independently.

Specialization only on assignment

When PDF objects were created, all classes were searched for possible specializations: for example, a Dictionary with a #Type entry was automatically converted to its corresponding class.

In the new version, objects are only typed and specialized when they are assigned to an attribute of a Dictionary or Array.

System classes as PDF classes

The first version had wrappers for all basic types of PDF, such as null, booleans, numbers etc.. This is similar to boxing of primitive types in other programming languages.

The motivation was to accurately implement any semantic differences to the corresponding Smalltalk objects in a proper place. This lead to the wide spread use of #asPDF and #asSmalltalkValue for boxing and unboxing.

Now I know that the differences are minor and that they could be properly implemented at the system classes. Therefore, I aligned some system classes with the PDF classes by declaring the system classes as PDF type and removing the PDF class: Null and Boolean. Next to go is Number; later maybe String and Date and…

This should lead to simpler code and more space and time efficient processing.

On the other hand, there are now a lot more root PDF classes. Therefore, I moved some of the general PDF behavior to Object.

  • releasenotes.1507634833.txt.gz
  • Last modified: 2017/10/10 13:27
  • by christian