A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-maga.1054.mcz ==================== Summary ==================== Name: Kernel-maga.1054 Author: maga Time: 23 January 2017, 1:22:40.269653 pm UUID: 32d479b9-040c-4441-ad6c-528dc7845676 Ancestors: Kernel-eem.1053 Provide altTrue as an alternative to false. May be required for US government approved use of Squeak starting 2017. =============== Diff against Kernel-eem.1053 =============== Item was added: + False subclass: #AlternateTrue + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Objects'! + + !AlternateTrue commentStamp: 'maga 1/23/2017 12:40' prior: 0! + AlternateTrue defines the behavior of its single instance, altTrue -- the opposite of true. It can be used in place of false whenever facts are inconvenient. + + 3 = 4 ifAltTrue: [Transcript show: 'Great!!'; cr]! Item was added: + ----- Method: AlternateTrue class>>initialize (in category 'class initialization') ----- + initialize + Smalltalk globals at: #altTrue ifAbsentPut: [self basicNew]. + ! Item was added: + ----- Method: AlternateTrue>>ifAltTrue: (in category 'controlling') ----- + ifAltTrue: alternativeBlock + "Answer the value of alternativeBlock." + + ^alternativeBlock value! Item was added: + ----- Method: AlternateTrue>>ifTrue: (in category 'controlling') ----- + ifTrue: alternativeBlock + "Since the condition is altTrue, answer the value of the alternate-true block, + which is nil." + + ^nil! Item was added: + ----- Method: AlternateTrue>>ifTrue:ifAltTrue: (in category 'controlling') ----- + ifTrue: trueBlock ifAltTrue: alternateTrueBlock + "Since the condition is altTrue, answer the value of alternateTrueBlock." + + ^alternateTrueBlock value! Item was added: + ----- Method: AlternateTrue>>printOn: (in category 'printing') ----- + printOn: aStream + aStream nextPutAll: 'altTrue'! Item was added: + ----- Method: Boolean>>ifAltTrue: (in category 'controlling') ----- + ifAltTrue: alternativeBlock + "If the receiver is true (i.e., the condition is true), then the value is the + true alternative, which is nil. Otherwise answer the result of evaluating + the argument, alternativeBlock. Create an error notification if the + receiver is nonBoolean." + + self subclassResponsibility! Item was added: + ----- Method: Boolean>>ifTrue:ifAltTrue: (in category 'controlling') ----- + ifTrue: trueBlock ifAltTrue: alternateTrueBlock + "If the receiver is true (i.e., the condition is true), then answer the value + of the argument trueBlock. If the receiver is altTrue, answer the + result of evaluating the argument alternateTrueBlock. If the receiver + is a nonBoolean then create an error notification." + + self subclassResponsibility! Item was added: + ----- Method: False>>ifAltTrue: (in category 'controlling') ----- + ifAltTrue: alternativeBlock + "Answer the value of alternativeBlock." + + ^alternativeBlock value! Item was added: + ----- Method: False>>ifTrue:ifAltTrue: (in category 'controlling') ----- + ifTrue: trueBlock ifAltTrue: alternateTrueBlock + "Answer the value of alternateTrueBlock." + + ^alternateTrueBlock value! Item was added: + ----- Method: True>>ifAltTrue: (in category 'controlling') ----- + ifAltTrue: alternativeBlock + "Since the condition is true, the value is the true alternative, which is nil." + + ^nil! Item was added: + ----- Method: True>>ifTrue:ifAltTrue: (in category 'controlling') ----- + ifTrue: trueBlock ifAltTrue: alternateTrueBlock + "Answer with the value of trueBlock." + + ^trueBlock value! |
Ah, my world makes sense once more. Thank you ;-)
Dave > A new version of Kernel was added to project The Inbox: > http://source.squeak.org/inbox/Kernel-maga.1054.mcz > > ==================== Summary ==================== > > Name: Kernel-maga.1054 > Author: maga > Time: 23 January 2017, 1:22:40.269653 pm > UUID: 32d479b9-040c-4441-ad6c-528dc7845676 > Ancestors: Kernel-eem.1053 > > Provide altTrue as an alternative to false. May be required for US > government approved use of Squeak starting 2017. > > =============== Diff against Kernel-eem.1053 =============== > > Item was added: > + False subclass: #AlternateTrue > + instanceVariableNames: '' > + classVariableNames: '' > + poolDictionaries: '' > + category: 'Kernel-Objects'! > + > + !AlternateTrue commentStamp: 'maga 1/23/2017 12:40' prior: 0! > + AlternateTrue defines the behavior of its single instance, altTrue -- > the opposite of true. It can be used in place of false whenever facts are > inconvenient. > + > + 3 = 4 ifAltTrue: [Transcript show: 'Great!!'; cr]! > > Item was added: > + ----- Method: AlternateTrue class>>initialize (in category 'class > initialization') ----- > + initialize > + Smalltalk globals at: #altTrue ifAbsentPut: [self basicNew]. > + ! > > Item was added: > + ----- Method: AlternateTrue>>ifAltTrue: (in category 'controlling') > ----- > + ifAltTrue: alternativeBlock > + "Answer the value of alternativeBlock." > + > + ^alternativeBlock value! > > Item was added: > + ----- Method: AlternateTrue>>ifTrue: (in category 'controlling') ----- > + ifTrue: alternativeBlock > + "Since the condition is altTrue, answer the value of the alternate-true > block, > + which is nil." > + > + ^nil! > > Item was added: > + ----- Method: AlternateTrue>>ifTrue:ifAltTrue: (in category > 'controlling') ----- > + ifTrue: trueBlock ifAltTrue: alternateTrueBlock > + "Since the condition is altTrue, answer the value of > alternateTrueBlock." > + > + ^alternateTrueBlock value! > > Item was added: > + ----- Method: AlternateTrue>>printOn: (in category 'printing') ----- > + printOn: aStream > + aStream nextPutAll: 'altTrue'! > > Item was added: > + ----- Method: Boolean>>ifAltTrue: (in category 'controlling') ----- > + ifAltTrue: alternativeBlock > + "If the receiver is true (i.e., the condition is true), then the value > is the > + true alternative, which is nil. Otherwise answer the result of > evaluating > + the argument, alternativeBlock. Create an error notification if the > + receiver is nonBoolean." > + > + self subclassResponsibility! > > Item was added: > + ----- Method: Boolean>>ifTrue:ifAltTrue: (in category 'controlling') > ----- > + ifTrue: trueBlock ifAltTrue: alternateTrueBlock > + "If the receiver is true (i.e., the condition is true), then answer the > value > + of the argument trueBlock. If the receiver is altTrue, answer the > + result of evaluating the argument alternateTrueBlock. If the receiver > + is a nonBoolean then create an error notification." > + > + self subclassResponsibility! > > Item was added: > + ----- Method: False>>ifAltTrue: (in category 'controlling') ----- > + ifAltTrue: alternativeBlock > + "Answer the value of alternativeBlock." > + > + ^alternativeBlock value! > > Item was added: > + ----- Method: False>>ifTrue:ifAltTrue: (in category 'controlling') ----- > + ifTrue: trueBlock ifAltTrue: alternateTrueBlock > + "Answer the value of alternateTrueBlock." > + > + ^alternateTrueBlock value! > > Item was added: > + ----- Method: True>>ifAltTrue: (in category 'controlling') ----- > + ifAltTrue: alternativeBlock > + "Since the condition is true, the value is the true alternative, which > is nil." > + > + ^nil! > > Item was added: > + ----- Method: True>>ifTrue:ifAltTrue: (in category 'controlling') ----- > + ifTrue: trueBlock ifAltTrue: alternateTrueBlock > + "Answer with the value of trueBlock." > + > + ^trueBlock value! > > > |
Free forum by Nabble | Edit this page |