While revisiting
http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/131331
and http://thread.gmane.org/gmane.comp.lang.smalltalk.squeak.general/131333,
I was intrigued by this:
VariableNode>>canBeSpecialArgument
"Can I be an argument of (e.g.) ifTrue:?"
^code < LdNil
? (as in chess notation)
First reflex was to check that LdTrue and LdFalse both are < LdNil, so
true and false pseudo variables canBeSpecialArgument.
LdSelf too.
This required more digging to find that other variables (inst var,
temp vars etc...) have code < 0 < LdNil.
So this means that a variable canBeSpecialArgument (but not the nil
pseudo-variable).
Who needs that ?
MessageNode>>#checkBlock:as:from:maxArgs: uses
node canBeSpecialArgument ifTrue:
[^node isBlockNode].
So inlined messages require a Block in order to be inlined.
The other sender is MessageNode>>#transformCase:
Ah yes, we tolerate a variable here:
^encoder notify: 'caseOf: argument must be a brace construct or a variable'
This is limiting a bit the usual chaining power... A variable would be
OK, but another expression would not?
No it wouldn't, as advertised above... For example this makes a Compiler bark:
| lowab upAB |
lowab := { [$a] -> [1]. [$b] -> [2] }.
upAB := { [$a] -> [1]. [$b] -> [2] }.
$a caseOf: lowab , upAB otherwise: [0]
Note that the otherwise argument once upon a time had to be a 0-arg block...
... but I changed #checkBlock:as:from:maxArgs: to tolerate non block
some time ago
It now just turns message inlining off if not a block.
I understand the intention, the syntax of caseOf: is quite unfriendly
and we wanted to enforce rules just to help people learn it. But...
1) Noting that by now, any Object respondsTo: #value, an that we can
consequently write
| lowab |
lowab := { $a -> 1. $b -> 2 }.
$a caseOf: lowab otherwise: 0
2) Noting that other special messages supports inlining off and will
eventually let the receiver bark when not understood at run time.
3) Noting that forcing usage of a variable versus any other expression
creates a syntax singularity.
4) Noting there are holes in the barking anyway, (self caseOf: nil)
barks, (self caseOf: true) doesn't
I would now tend to reduce the barking and simplify
canBeSpecialArgument, and transformCase:
What do you think ?
Nicolas
I have just posted Squeak-4.2-All-in-One.zip to http://ftp.squeak.org/4.2.
It's a zip that contains VM's for Windows, Linux and Mac. The idea is
anyone can download this, unzip it, then simply double-click on the
appropriate launch:
Linux users --> squeak.sh
Windows users --> Squeak.exe
Mac -->
I have access to Linux and Windows, this is working with the latest
VMs (Linux 4.4.7 and 4.1.1 Windows) for those platforms. However, the
Mac VM currently included is the one that was shipped in the
Squeak-4.1-All-in-One.zip. I don't know if we want to include
Estebans new VM with 4.2 or not.
I have no access or knowledge about Macs. Would someone with a Mac
please help us and test and/or upgrade the Mac VM in this file? This
is one of the last remaining steps to release 4.2.
Thanks,
Chris
I omitted to mention a minor change
and: [] and [] -> and: [ and: []]
(fed up of reverting my changes)
Nicolas
2011/2/4 <commits(a)source.squeak.org>:
> Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
> http://source.squeak.org/trunk/Graphics-nice.176.mcz
>
> ==================== Summary ====================
>
> Name: Graphics-nice.176
> Author: nice
> Time: 4 February 2011, 12:52:27.728 am
> UUID: ddd38c78-5d87-4fc0-b547-f9a991cf4167
> Ancestors: Graphics-ul.175
>
> Add an inst var charIndexCompatibilitySlot in order to let the japanese locale test pass.
>
> Some old .sar are using ReferenceStream binary format for saving some objets.
> Unfortunately, ReferenceStream - unlike SmartRefStream - can't cope with modification of Object structure.
>
> This is a backward compatibility workaround with these .sar. In the future, StrikeFont should use SmartRefStream and these .sar should be converted.
>
> =============== Diff against Graphics-ul.175 ===============
>
> Item was changed:
> AbstractFont subclass: #StrikeFont
> + instanceVariableNames: 'characterToGlyphMap xTable glyphs name type minAscii maxAscii maxWidth strikeLength ascent descent xOffset raster subscript superscript emphasis derivativeFonts pointSize fallbackFont charIndexCompatibilitySlot'
> - instanceVariableNames: 'characterToGlyphMap xTable glyphs name type minAscii maxAscii maxWidth strikeLength ascent descent xOffset raster subscript superscript emphasis derivativeFonts pointSize fallbackFont'
> classVariableNames: 'DefaultStringScanner'
> poolDictionaries: 'TextConstants'
> category: 'Graphics-Fonts'!
>
> !StrikeFont commentStamp: '<historical>' prior: 0!
> I represent a compact encoding of a set of Forms corresponding to characters in the ASCII character set. All the forms are placed side by side in a large form whose height is the font height, and whose width is the sum of all the character widths. The xTable variable gives the left-x coordinates of the subforms corresponding to the glyphs. Characters are mapped to glyphs by using the characterToGyphMap.
>
> Subclasses can have non-trivial mapping rules as well as different representations for glyphs sizes (e.g., not using an xTable). If so, these classes should return nil when queried for xTable and/or the characterToGlyphMap. This will cause the CharacterScanner primitive to fail and query the font for the width of a character (so that a more programatical approach can be implemented).
>
> For display, fonts need to implement two messages:
> #installOn: aDisplayContext foregroundColor: foregroundColor backgroundColor: backgroundColor
> This method installs the receiver (a font) on the given DisplayContext (which may be an instance of BitBlt or Canvas (or any of it's subclasses). The font should take the appropriate action to initialize the display context so that further display operations can be optimized.
> #displayString: aString on: aDisplayContext from: startIndex to: stopIndex at: aPoint kern: kernDelta
> This method is called for each subsequent run of characters in aString which is to be displayed with the (previously installed) settings.
> !
>
> Item was changed:
> ----- Method: WarpBlt>>cellSize: (in category 'setup') -----
> cellSize: s
> "Set the number of samples used for averaging"
> cellSize := s.
> cellSize = 1 ifTrue: [^ self].
> "Install the colorMap to used for mapping the averaged RGBA 32bit pixels to the
> destination depth. Note that we need to install the 32->32 color map explicitly because
> the VM will substitute a colorMap derived from sourceForm->destForm mapping which
> is just plain wrong for <32 source and 32bit dest depth"
> + (destForm depth = 32 and: [sourceForm notNil and: [sourceForm depth < 32]])
> - (destForm depth = 32 and: [sourceForm notNil] and: [sourceForm depth < 32])
> ifTrue:[colorMap := ColorMap shifts: #(0 0 0 0) masks:#(16rFF0000 16rFF00 16rFF 16rFF000000) colors: nil]
> ifFalse:[colorMap := Color colorMapIfNeededFrom: 32 to: destForm depth].
> !
>
>
>
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.542.mcz
==================== Summary ====================
Name: Kernel-nice.542
Author: nice
Time: 4 February 2011, 1:00:46.508 am
UUID: ea1d8beb-aa2d-4cf3-8389-2072df48f6e3
Ancestors: Kernel-ul.541
thu shalt not invoke super in vain
=============== Diff against Kernel-ul.541 ===============
Item was changed:
Dictionary variableSubclass: #MethodDictionary
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Kernel-Methods'!
+ !MethodDictionary commentStamp: 'nice 2/1/2011 02:47' prior: 0!
+ I am a special dictionary holding methods. I am just like a normal Dictionary, except that I am implemented differently. Each Class has an instance of MethodDictionary to hold the correspondence between selectors (names of methods) and methods themselves.
- !MethodDictionary commentStamp: 'ul 10/30/2009 04:43' prior: 0!
- I am just like a normal Dictionary, except that I am implemented differently. Each Class has an instances of MethodDictionary to hold the correspondence between selectors (names of methods) and methods themselves.
In a normal Dictionary, the instance variable 'array' holds an array of Associations. Since there are thousands of methods in the system, these Associations waste space.
Each MethodDictionary is a variable object, with the list of keys (selector Symbols) in the variable part of the instance. The variable 'array' holds the values, which are CompiledMethods.
I also maintain the following invariant: (self basicAt: index) isNil = (array at: index) isNil.!
Item was changed:
----- Method: MethodDictionary>>includesKey: (in category 'accessing') -----
includesKey: aSymbol
+ "This override assumes that instVarsInclude: uses a fast primitive"
- "This override assumes that pointsTo is a fast primitive"
aSymbol ifNil: [^ false].
+ ^ self instVarsInclude: aSymbol!
- ^ super instVarsInclude: aSymbol!
Changes to Trunk (http://source.squeak.org/trunk.html) in the last 24 hours:
http://lists.squeakfoundation.org/pipermail/packages/2011-February/004213.h…
Name: Installer-Core-mtf.343
Ancestors: Installer-Core-ul.342
Added "Installer cobalt" to name the cobalt squeaksource
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-February/004216.h…
Name: Tools-laza.294
Ancestors: Tools-cmm.293
Display DependencyBrowsers class comment in it's code pane while no method is selected, to give a clue about what is being shown in the list
views
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2011-February/004217.h…
Name: Graphics-nice.176
Ancestors: Graphics-ul.175
Add an inst var charIndexCompatibilitySlot in order to let the japanese locale test pass.
Some old .sar are using ReferenceStream binary format for saving some objets.
Unfortunately, ReferenceStream - unlike SmartRefStream - can't cope with modification of Object structure.
This is a backward compatibility workaround with these .sar. In the future, StrikeFont should use SmartRefStream and these .sar should be converted.
=============================================
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.176.mcz
==================== Summary ====================
Name: Graphics-nice.176
Author: nice
Time: 4 February 2011, 12:52:27.728 am
UUID: ddd38c78-5d87-4fc0-b547-f9a991cf4167
Ancestors: Graphics-ul.175
Add an inst var charIndexCompatibilitySlot in order to let the japanese locale test pass.
Some old .sar are using ReferenceStream binary format for saving some objets.
Unfortunately, ReferenceStream - unlike SmartRefStream - can't cope with modification of Object structure.
This is a backward compatibility workaround with these .sar. In the future, StrikeFont should use SmartRefStream and these .sar should be converted.
=============== Diff against Graphics-ul.175 ===============
Item was changed:
AbstractFont subclass: #StrikeFont
+ instanceVariableNames: 'characterToGlyphMap xTable glyphs name type minAscii maxAscii maxWidth strikeLength ascent descent xOffset raster subscript superscript emphasis derivativeFonts pointSize fallbackFont charIndexCompatibilitySlot'
- instanceVariableNames: 'characterToGlyphMap xTable glyphs name type minAscii maxAscii maxWidth strikeLength ascent descent xOffset raster subscript superscript emphasis derivativeFonts pointSize fallbackFont'
classVariableNames: 'DefaultStringScanner'
poolDictionaries: 'TextConstants'
category: 'Graphics-Fonts'!
!StrikeFont commentStamp: '<historical>' prior: 0!
I represent a compact encoding of a set of Forms corresponding to characters in the ASCII character set. All the forms are placed side by side in a large form whose height is the font height, and whose width is the sum of all the character widths. The xTable variable gives the left-x coordinates of the subforms corresponding to the glyphs. Characters are mapped to glyphs by using the characterToGyphMap.
Subclasses can have non-trivial mapping rules as well as different representations for glyphs sizes (e.g., not using an xTable). If so, these classes should return nil when queried for xTable and/or the characterToGlyphMap. This will cause the CharacterScanner primitive to fail and query the font for the width of a character (so that a more programatical approach can be implemented).
For display, fonts need to implement two messages:
#installOn: aDisplayContext foregroundColor: foregroundColor backgroundColor: backgroundColor
This method installs the receiver (a font) on the given DisplayContext (which may be an instance of BitBlt or Canvas (or any of it's subclasses). The font should take the appropriate action to initialize the display context so that further display operations can be optimized.
#displayString: aString on: aDisplayContext from: startIndex to: stopIndex at: aPoint kern: kernDelta
This method is called for each subsequent run of characters in aString which is to be displayed with the (previously installed) settings.
!
Item was changed:
----- Method: WarpBlt>>cellSize: (in category 'setup') -----
cellSize: s
"Set the number of samples used for averaging"
cellSize := s.
cellSize = 1 ifTrue: [^ self].
"Install the colorMap to used for mapping the averaged RGBA 32bit pixels to the
destination depth. Note that we need to install the 32->32 color map explicitly because
the VM will substitute a colorMap derived from sourceForm->destForm mapping which
is just plain wrong for <32 source and 32bit dest depth"
+ (destForm depth = 32 and: [sourceForm notNil and: [sourceForm depth < 32]])
- (destForm depth = 32 and: [sourceForm notNil] and: [sourceForm depth < 32])
ifTrue:[colorMap := ColorMap shifts: #(0 0 0 0) masks:#(16rFF0000 16rFF00 16rFF 16rFF000000) colors: nil]
ifFalse:[colorMap := Color colorMapIfNeededFrom: 32 to: destForm depth].
!
Squeak4.2-10950.zip is now available at http://ftp.squeak.org/4.2,
which is intended to be the actual-released 4.2 image (unless we find
some problem, which we won't).
The trunk will be reopened shortly, thanks for your patience.
- Chris