8

the usual installation descriptions tells me that I need to run Pharo at least three files:

  1. image file
  2. changes file
  3. source file (e.g. PharoV10.sources)

I've run Pharo 2 without the sources file and i didn't see any problem. All sources seemed to be avaiable.

So, why do I need the sources file (e.g. PharoV10.sources)?

3 Answers3

8

The image file contains only the compiled code, not the original source code. The changes file contains source code for the stuff that you added to the system yourself but not source code for existing system classes. To get the source code for existing system classes you need the sources file.

Having said that, Smalltalk can decompile the code and produce what looks like source code if the sources file isn't available. This code will be missing proper variable names, comments and spacing. You really don't want to use decompiled source code so you need access to the sources file.

David Buck
  • 2,847
  • 15
  • 16
6

3 possible explanations, try to identify the joke:

  1. the Browser is smart enough to show you a source reconstructed (Decompiled) from the CompiledMethod byte codes. Hint: in this case, you loose all comments
  2. there is a search path for the sources files, and one is found somewhere on your disk
  3. Pharo is changing so fast that every source is now found in the .changes file

For verifying 1., you could try to browse references to Decompiler (there are a bit too many uses to my own taste).

For verifying 2., you could start browsing implementors of #openSourceFiles

For verifying 3., you could evaluate this snippet:

| nSources nChanges |
nSources := nChanges := 0.
SystemNavigation default allBehaviorsDo: [:b |
    b selectorsDo: [:s |
        (b compiledMethodAt: s) fileIndex = 1
            ifTrue: [nSources := nSources+1]
            ifFalse: [nChanges := nChanges+1]]].
^{nSources. nChanges}
aka.nice
  • 9,100
  • 1
  • 28
  • 40
4

It is also possible that Pharo downloads PharoV10.sources automatically.

Damien Cassou
  • 2,555
  • 1
  • 16
  • 21
  • In the meantime time I noticed that Pharo 2.0 seems to generate or download the sources automatically. If I start Pharo 2.0 image without sources an image file occurs suddenly in the VM folder, whereas older Pharo images (1.4) shown an error message during start up. – user1801323 Nov 06 '12 at 14:35