[Cuis] 4 additions to core?

Juan Vuletich juan at jvuletich.org
Sun May 10 13:31:16 CDT 2015


Hi Hannes,

I added #join: to Cuis base.

But I added the others to package SqueakCompatibility.pck.st. Reasons are:

- String >> withCRs
Most times, what we really want is #withNewlines. But sometimes #withCRs 
is what's really needed. It depends on each case, and the package porter 
needs to decide. Having #withCRs in the base image would make it look 
like it is an "usual" Cuis method.

- Symbol >> value:
In Cuis, Symbol is not generally polymorphic with blocks. Changing that 
would be a decision to make. And to be consistent, we'd also support  
stuff like 'aCollection collect: #printString'. I'm not sure I like that 
style, and in any case, it is not to be done without some discussion.

- Character >> isCharacter
I guess we'd also need to add it to Object for this to make sense. But 
we all agree that calling isXXX methods is not nice style, right?

WRT |$b digitValue|, in Cuis 16rB is valid, and 16rb is not. Letters as 
digits must be uppercase. This makes things like 10r1.2e3 unambiguous. 
Supporting lowercase digits would require some discussion. Is there any 
real need for this?

WRT #assert:description: , I added it to Cuis base. Sounds nice to have. 
I also adapted TestCase>>assert:description: to accept a block.

When the new updates are on github (hopefully later today), please load 
SqueakCompatibility.pck.st, and check if I missed something.

Thanks!
Juan Vuletich


On 5/9/2015 4:21 PM, H. Hirzel wrote:
> Hello Juan
>
> As from the porting effort for NeoCSV I propose the following
> additions for discussion to add to the core.
>
> All methods are from Pharo 4.0
>
> See attachment.
>
>
> Regards
>
> Hannes
>
>
>
>
> 'From Cuis 4.2 of 25 July 2013 [latest update: #2243] on 9 May 2015 at
> 7:17:46.231872 pm'!
>
> !String methodsFor: 'copying' stamp: 'hjh 5/9/2015 16:32'!
> join: aCollection
> 	"'*' join: #('WWWWW' 'W  EW' 'zzzz')
> 		->   'WWWWW*W  EW*zzzz' "
>
> 	| w |		
> 	w := WriteStream on: String new.
> 	aCollection do: [ :elem | w nextPutAll: elem asString] separatedBy:
> [w nextPutAll: self].
> 	^String fromString: w contents! !
>
> !String methodsFor: 'formatting' stamp: 'hjh 5/9/2015 17:03'!
> withCRs
> 	"Return a copy of the receiver in which backslash (\) characters have
> been replaced with carriage returns."
>
> 	^ self collect: [ :c | c = $\ ifTrue: [ Character cr ] ifFalse: [ c ]].! !
>
>
> !Symbol methodsFor: 'private' stamp: 'hjh 5/9/2015 17:37'!
> value: anObject
> 	^anObject perform: self.! !
>
>
> !Character methodsFor: 'testing' stamp: 'hjh 5/9/2015 17:11'!
> isCharacter
>
> 	^ true.! !
>
>
> _______________________________________________
> Cuis mailing list
> Cuis at jvuletich.org
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150510/cfc06a07/attachment-0004.html>


More information about the Cuis mailing list