Couple more answers. On Sat, Oct 01, 2016 at 09:29:51AM -0700, CodeDmitry wrote:
3. Is it possible to prevent Pharo from screwing up indenting of my class definitions when I save?(It keeps replacing leading spaces with a tab). If so how?
Yes and no, you can specify indent string in "Code Browsing > BlueInk Pretty Printing", however when you press "tab" it will still insert tab. This setting only applies to autoformatting. (ctrl+shift+f). As for class definition, the implementation is in ClassDescription>>definition, where you can see things like aStream cr; tab; nextPutAll: 'instanceVariableNames: '; store: self instanceVariablesString. so you would need to change >aStream cr; tab< into >aStream cr; nextPutAll: 'your indentation spaces'< Or you can do that en masse... newCode := (ClassDescription>>#definition) sourceCode copyReplaceAll: 'tab;' with: ''' '';'. ClassDescription compile: newCode. And add that code into a StartupScript or somewhere.
4. How can I create a Pharo package from Playground using code?
RPackage organizer createPackageNamed: 'Hello'.
I suspect 4 and 5 are possible because Pharo allows dynamic insertion/removal of methods from classes using the class method dictionary and runtime compile.
As a bonus in answer to "3." you can also see how to dynamically compile a method. :) Peter