Monthly Archives: June 2014

The Pharo way: One step after the other

40051
13428 Small code critique cleanup of RecentSubmissions
https://pharo.fogbugz.com/f/cases/13428

13427 Small code critique clean of Tools
https://pharo.fogbugz.com/f/cases/13427

 

40050
13425 Simplify API of VersionsBrowser
https://pharo.fogbugz.com/f/cases/13425

13426 retire old VersionsBrowser
https://pharo.fogbugz.com/f/cases/13426

 

40049
13424 Clean up #priorTimeStamp
https://pharo.fogbugz.com/f/cases/13424

13423 VersionBrowser>>#versionCountForSelector:class: not needed
https://pharo.fogbugz.com/f/cases/13423

40048
13420 Abstract slot class should emit code to reflectively read the slot
https://pharo.fogbugz.com/f/cases/13420

13419 remove OCInstanceVariable
https://pharo.fogbugz.com/f/cases/13419

 

40046
13406 Opal should delegate code generation for Slots to the Slot meta object
https://pharo.fogbugz.com/f/cases/13406

40045
13410 Wrong Nautilus is registered as default browser
https://pharo.fogbugz.com/f/cases/13410

13395 Add SHA256 HashFunction
https://pharo.fogbugz.com/f/cases/13395

40044
– add subclass for Slot
– change all Slot objects for that class

40043
13400 API for slots on Classes
https://pharo.fogbugz.com/f/cases/13400

40042
13397 Failing tests SHA256Tests
https://pharo.fogbugz.com/f/cases/13397

13396 Failing test: ReleaseTests>>#testLocalMethodsOfTheClassShouldNotBeRepeatedInItsTraits
https://pharo.fogbugz.com/f/cases/13396

40041
13395 Add SHA256 HashFunction
https://pharo.fogbugz.com/f/cases/13395

13379 ReleaseTests #testObsoleteClasses failing: AnObsoleteSourceWebBrowser
https://pharo.fogbugz.com/f/cases/13379

40040
13287 Failing test: testLayoutIntegrity and testSlotScopeParallelism
https://pharo.fogbugz.com/f/cases/13287

40039
13348 Display progress when running lint rules
https://pharo.fogbugz.com/f/cases/13348

13391 add #visibleSlots to layout
https://pharo.fogbugz.com/f/cases/13391

 

40038
13378 DynamicVariable cannot be stepped in debugger
https://pharo.fogbugz.com/f/cases/13378

Advertisements

First class instance variables getting exciting

Marcus Denker is improving the interaction between the new compiler and the
first class instance variables and the results look exciting. I remember brainstorming and
prototyping a solution in 2007 with him and this is wonderful to see this getting real.
Here is the description made by Marcus:

So now Opal delegates code generation for read and write to the Slot meta objects.
The methods called are #emitValue: and #emitStore:, the parameter is an IRBuilder.

With this the implementor of a Slot is free to generate whatever bytecode needed, it will
be inlined at the read or assignment site in the method.

For the ivar Slot this is e.g. just

emitStore: methodBuilder

 methodBuilder storeInstVar: index

emitValue: methodBuilder

 methodBuilder pushInstVar: index.

Now the implementors of Slots should not need to be bothered about bytecode, therefore we have
in the superclass of all Slots defaults emit methods that implement a *reflective* read and write using
the MOP of the Slot itself (slower than code generation, but often enough):

emitValue: aMethodBuilder
 aMethodBuilder
 pushLiteral: self;
 pushReceiver;
 send: #read:

emitStore: aMethodBuilder
 aMethodBuilder
 pushLiteral: self;
 pushReceiver;
 send: #writeToSlot:of: 

What this means is that for someone who wants to implement a slot, you do not have to deal with bytecode at all.

Here is a simple Slot:

Slot subclass: #TestSlot
 instanceVariableNames: 'value'
 classVariableNames: ''
 category: 'Slot-Scope’


read: anObject
 ^ value

write: aValue to: anObject
 value := aValue

So this is a strange kind of Slot that stores the value in itself, which means it is shared between all objects as there is only
one Slot meta object per class per slot. (not something you want to do in real world, but a nice demo)

Now we can create a class (not yet easily as we have not yet enabled a class template, so lets use the ClassBuilder directly):

PharoClassInstaller make: [ :builder |
 builder name: #A;
 slots: { TestSlot named: #iv };
 category: #Playground ].


In class A we can implement accessors:

iv
 ^iv

iv: anObject
 iv := anObject

They look like normal ivar accesses, but in the background, the compiler delegated to the Slot the code generation, calling emit*, which leads
to the bytecode e.g. for the read:

21 <20> pushConstant: iv => TestSlot
22 <70> self
23 <E1> send: read:
24 <7C> returnTop

you could override the emit* methods to generate faster code, but to get something running it is not needed.

To test, e.g. you can set the slot from one object and read it from another:

A new iv: 6
A new iv

Then inspect the slot:

(A slotNamed: #iv) inspect

(this should all Work in 4.0 048, the example is there as TestSlot for now)

…next steps:

1) Class Definition template for classes with Slots
2) How do we save these classes in Monticello?
3) Virtual Slots (Boolean and PropertySlots)

Marcus

Tagged

The legendary HP-35 Scientific Pocket Calculator

Sven van Caekenberghe wrote a new, extensive, long form, introductory article about Pharo:
A tutorial on Pharo, test and specification based immersive programming
Image
It is a bit different because
 – it is based on a non-trivial example
 – it uses a backdrop story unrelated to Pharo
 – it uses several multimedia elements
 – it is published on medium.com which is a general publishing platform
The appendix describes several ways you can get the code. I think building both a Spec and Seaside UI from the same specification as well as reusing functional tests in different contexts is cool. Anyway, I hope you enjoy it.
Sven

A hackish week-end

40037
13371 AlphaImageMorph should be move to the same package as ImageMorph
https://pharo.fogbugz.com/f/cases/13371

13372
CheckboxButtonMorph should be move to the same package as its superclass
https://pharo.fogbugz.com/f/cases/13372

40036
13352 Move some polymorphic extensions to their classes
https://pharo.fogbugz.com/f/cases/13352

40035
13354 should move Tabs into Morphic-Widgets-Tabs
https://pharo.fogbugz.com/f/cases/13354

13362 FileList should be extracted from Tools and move to MorphicWidgets-FileList
https://pharo.fogbugz.com/f/cases/1336240034

13359 Pluggable* should be move out of Morpphic-Base and put in Morphic-Widgets-Pluggable
https://pharo.fogbugz.com/f/cases/13359

40032
13363 Tools-Explorer category should be turned into Tool-Explorer package
https://pharo.fogbugz.com/f/cases/13363

13363 Tools-Explorer category should be turned into Tool-Explorer package
https://pharo.fogbugz.com/f/cases/13363

40031
13358 TreeMorph* should be extracted from Morphic-Base and put in its own package
https://pharo.fogbugz.com/f/cases/13358

13361 Extracted Spotlight from tools and move it to Tool-Spotlight
https://pharo.fogbugz.com/f/cases/13361

40030
13355 should extract Workspace in Tool-Workspace
https://pharo.fogbugz.com/f/cases/13355

13356 should move Morphic-base list into Morphic-Widgets-List
https://pharo.fogbugz.com/f/cases/13356

40029
13351 Tool-Finder should be extracted from Tools
https://pharo.fogbugz.com/f/cases/13351

13350 Extract calendar to Morphic-Widgets-Extra
https://pharo.fogbugz.com/f/cases/13350

40028
13323 Cleaning PasteUpMorph mouseDown:
https://pharo.fogbugz.com/f/cases/13323

13226 Inst Var Pull Up refactoring also shows superclass inst vars
https://pharo.fogbugz.com/f/cases/13226

10935 AthensDemoMorph failing at figure9
https://pharo.fogbugz.com/f/cases/10935

TaskIt: Handling Processes Nicely

S. Bragagnolo announced TaskIt.  Task IT is package that provides a cool way to deal with processes. Even when this version is stable, it still in design and we want to make it consistent and powerfull. It comes with a chapter in pharo enterprise book and some cool tests. 
We have moved the main distribution repo to CAR
http://smalltalkhub.com/#!/~CAR/TaskIT/
 
The main easy things to do with this revision are:

” closures “
val := [ 2+2 ] shootIt.
val isKindOf: TKTFuture.
val onSuccess: [: rslt | rslt == 4 ] “async”
val value == 4. ” sync “
rslt := [ 2+2 ] shootIt asResult.
rslt == 4 “sync on demand”
 
” objects “
 
val := 2 paralellize + 2.
val == 4 “sync on demand”
 
 
” staying in tune “
 
val := [ “some task” ] shootIt asStickyReference.
val := nil.
” sticky means that if this future is taken by the GC, it will kill the process”

” looping  “

val := server paralellize looping serveOnce: anyParameter asStickyReference.
“this will execute in a new process, in a loop, server serveOnce: anyParameter.”
 
You can stop it by doing
val:= nil.

“or using a disgusting magic variable, for that check the samples :). But do not rely on that kind of things, because it will not be supported “

For more advanced and cool usages, check the Doc.

 
FAQ:

1- Yes, the “sync” on demand is implemented with a proxy and a become.

2- Yes, we are changing the API of the processes that persist in time.

CREDITS
  All CAR team in general was great inspiration, particularly, Guille Polito full operational commiter and  of course is always a good idea to discuss with him,  Nick Papoylias, is also great to discuss with him. Luc, Noury, Jannik: several ideas are discussed with them as well, and they always gave me support.

and from RMOD Esteban Lorenzano, also discussing and proposing.

Thanks all :).
 OTHERS:
If you want to go to the darkside (dark because is not documented yet, but in the case of PoolIT, that it has some doc ) you can also add to your combo:
ActIT: a simple Actor extention for taskit.
ForkIT: an extention that runs blocks in background image (it adds a nice button to the test runner, letting you run all your tests in a background image and installing the results after the execution)
PoolIT: it adds a pool of workers, it consumes tasks and ensure you a limited amount of threads.
PlanIT: a basic and not yet full developed algebra for composing processes.

I encourage you to use it, it is being used in PhaROS since a lot  of time. And please any bug and enhancements, you can contact us. Since we are working on the next version is a good time to define what features are really needed.

Another week of enhancements

40027
13343 Should move some spec morphic adapter extensions to their classes
https://pharo.fogbugz.com/f/cases/13343

40026
11987 Launching ProfStef should now require initials
https://pharo.fogbugz.com/f/cases/11987

12579 SyntaxErrorNotification>>messageText
https://pharo.fogbugz.com/f/cases/12579

 

40025
13341 small simplification: #morphicLayerNumberWithin:
https://pharo.fogbugz.com/f/cases/13341

13345 Fix some references to non-existing classes: MethodContext, MIMEType
https://pharo.fogbugz.com/f/cases/13345

12859 colorChangedForSubmorph: unused
https://pharo.fogbugz.com/f/cases/12859

40024
13308 MNU in EyeMorphViewer
https://pharo.fogbugz.com/f/cases/13308

13242 SUnit shows wrong test result when Warning subclass signals on a test case method
https://pharo.fogbugz.com/f/cases/13242

13340 tiny recategorization of uncategorised methods
https://pharo.fogbugz.com/f/cases/13340

40023
13332 fix #cleanUpForProduction for 4
https://pharo.fogbugz.com/f/cases/13332

13336 FontChooser and FontInfrastructure do not have the 40 repository added to themselves.
https://pharo.fogbugz.com/f/cases/13336

40022
12860 valueOfProperty: #fileListModel.
https://pharo.fogbugz.com/f/cases/12860

13326 Gofer: Add loadBleedingEdge
https://pharo.fogbugz.com/f/cases/13326

13330 Small code critique cleanup in Tools
https://pharo.fogbugz.com/f/cases/13330

40021
13089 reciprocalFloorLog: should be deprecated or just removed
https://pharo.fogbugz.com/f/cases/13089

13303 komitter is still using Pharo30Inbox as destination of new slices
https://pharo.fogbugz.com/f/cases/13303

40020
13320 Clean old condense sources/changes
https://pharo.fogbugz.com/f/cases/13320

13321 findSubstringViaPrimitive: key in: body startingAt: start matchTable: matchTable do not rely to correct character in source.
https://pharo.fogbugz.com/f/cases/13321

40019
13319 Small recategorization in Network-MIME to test money
https://pharo.fogbugz.com/f/cases/13319

13262 UITestCase in wrong package
https://pharo.fogbugz.com/f/cases/13262

40018
13289 Failing test: ReleaseTest>>#testObsoleteClasses
https://pharo.fogbugz.com/f/cases/13289

13288 Failing test: CodeSimulationTests>>#testErrorCodeNotFound
https://pharo.fogbugz.com/f/cases/13288

40017
13316 Nautilus sorts instVarNames
https://pharo.fogbugz.com/f/cases/13316

13277 Speed up String>>=
https://pharo.fogbugz.com/f/cases/13277

40016
13286 Failing test: testBehaviorRespectsPolymorphismWithTraitBehavior
https://pharo.fogbugz.com/f/cases/13286

13314 Workspace save to file on accept does not take line ending settings into account
https://pharo.fogbugz.com/f/cases/13314

40015
13281 Wrong environment when browsing scoped
https://pharo.fogbugz.com/f/cases/13281

13301 Update metacelloPlatformAttributes
https://pharo.fogbugz.com/f/cases/13301

13267 Settings Browser: Missing fields and file-dialogs in the Appearance Section
https://pharo.fogbugz.com/f/cases/13267

13285 duplicated test: testLocalMethodsOfTheClassShouldNotBeRepeatedInItsTraits
https://pharo.fogbugz.com/f/cases/13285

Base62/Base36

Norbert Hartl developed a package that contains util classes to en-/decode values into/from Base62/Base36.

Base62/Base36 encode numbers in short strings. These are used e.g. by url shortener services from google, bit.ly etc. 

Base36 uses lowercase letters and numbers to encode, Base62 uses all characters from Base36 plus all uppercase letters. Base62 produces smaller strings while Base36 produces case insensitive ones.

Example: 

Base62 fromNumber: 100000 -> 'q0U‘ 

Base36 fromNumber: 100000 -> ‚255s'

The package is available on SmalltalkHub.

40 alpha commits flow is going

40012
12858 Remove hasRolloverBorder – Second part
https://pharo.fogbugz.com/f/cases/12858

40011
12858 Remove hasRolloverBorder (Part 0)
https://pharo.fogbugz.com/f/cases/12858

40010
13270 Starting to Clean Fonts – Package introduction
https://pharo.fogbugz.com/f/cases/13270

40009
Tools saving to file without user feedback
https://pharo.fogbugz.com/default.asp?13038

Monticello choking on FTP repositories
https://pharo.fogbugz.com/default.asp?13254

valueOfProperty: #expandedExtent does not look to be set somewhere
https://pharo.fogbugz.com/default.asp?12861

40008
fourth trial
https://pharo.fogbugz.com/f/cases/13263/Morphic-Core-methods-recategorization

40007
13257 Pointless class creation menu in Nautilus
https://pharo.fogbugz.com/f/cases/13257

– add 30Inbox (to be removed later)

40006
13255 PNGReadWriter fails to read some .png format and do not always correctly read transparency back
https://pharo.fogbugz.com/f/cases/13255

13279 Add MetaRepoForPharo30 as one of the switchable Repositories to ConfigBrowser
https://pharo.fogbugz.com/f/cases/13279

40005
13278 ContextPart and MethodContext merged, remaining bugs
https://pharo.fogbugz.com/f/cases/13278

13282 Failing test: testGForceInria
https://pharo.fogbugz.com/f/cases/13282

– Unload Deprecated30

40004
13280 integrate pharo dark theme
https://pharo.fogbugz.com/f/cases/13280

40003
13273 ContextPart and MethodContext should be merged into a single class Context
https://pharo.fogbugz.com/f/cases/13273

This will need some more cleanups in a second step…
-> packages are dirty
-> some tests are failing