[Pharo-project] Streams. Status and where to go?

Igor Stasenko siguctua at gmail.com
Thu Feb 25 13:11:44 EST 2010


Hello,

i am cross-posting, since i think it is good for all of us to agree on
some common points.

1. Streams needs to be rewritten.
2. What do you think is good replacement for current Streams?

personally, i currently need a fast and concise UTF8 reader.
The UTF8TextConverter is closest thing what i would take, but i don't
understand, why
it implemented as a non-stream?

The #nextFromStream:
and #nextPut:toStream:
crying out of loud to be just
#next
and
#nextPut:

Another thing which makes me sad is this line:

nextFromStream: aStream

	| character1 value1 character2 value2 unicode character3 value3
character4 value4 |
	aStream isBinary ifTrue: [^ aStream basicNext].   <<<<<<<


All external streams is initially binary , but UTF8TextConverter wants
to play with characters, instead of octets..
But hey... UTF8 encoding is exactly about encoding unicode characters
into binary form..
I'm not even mentioning that operating with bytes (smallints) is times
more efficient than operating with characters (objects), because first
thing it does:

	character1 := aStream basicNext.  " a #basicNext, obviously, reads a
byte from somewhere and then converts it to instance of Character.
'Bonus' overhead here. "
	character1 isNil ifTrue: [^ nil].
	value1 := character1 asciiValue.  " and... what a surprise, we
converting a character back to integer value.. What a waste! "
	value1 <= 127 ifTrue: [

I really hope, that eventually we could have a good implementation,
where horse runs ahead of cart, not cart ahead of horse :)
Meanwhile i think i have no choice but make yet-another implementation
of utf8 reader in my own package, instead of using existing one.

-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list